Simplify ManualImportModule null check

This commit is contained in:
Qstick 2020-09-06 22:51:25 -04:00
parent e8e4d76d73
commit 6713525757
2 changed files with 16 additions and 7 deletions

View file

@ -78,5 +78,17 @@ namespace Lidarr.Http.Extensions
return defaultValue;
}
public static int? GetNullableIntegerQueryParameter(this Request request, string parameter, int? defaultValue = null)
{
var parameterValue = request.Query[parameter];
if (parameterValue.HasValue)
{
return int.Parse(parameterValue.Value);
}
return defaultValue;
}
}
}