mirror of
https://github.com/Readarr/Readarr
synced 2026-01-09 17:12:35 +01:00
Add GetIntegerQueryParameter for use later
This commit is contained in:
parent
b6cc303e1c
commit
f2502ff913
1 changed files with 12 additions and 0 deletions
|
|
@ -54,5 +54,17 @@ public static bool IsSharedContentRequest(this Request request)
|
|||
return request.Path.StartsWith("/MediaCover/", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
request.Path.StartsWith("/Content/Images/", StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
public static int GetIntegerQueryParameter(this Request request, string parameter, int defaultValue = 0)
|
||||
{
|
||||
var parameterValue = request.Query[parameter];
|
||||
|
||||
if (parameterValue.HasValue)
|
||||
{
|
||||
return int.Parse(parameterValue.Value);
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue