-
-
Notifications
You must be signed in to change notification settings - Fork 160
Closed
Labels
Milestone
Description
Something to ease up the following. Perhaps introduce an IQueryAccessor service?
private Guid? GetGuidFilter(string key)
{
var value = GetFilterValue(key);
if (value == null)
return null;
if (Guid.TryParse(value, out Guid result) == false)
throw new JsonApiException(422, $"'{value}' is not a valid guid value for query parameter {key}");
return result;
}
private string GetFilterValue(string key) => _jsonApiContext.QuerySet
.Filters
.FirstOrDefault(f => f.Key == key)
?.Value;