Closed
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;