public SortingFilter(string sortField, bool ascending) { var sortFields = SortingHelper.GetSortFields(); sortField = sortField.ToLower(); if (sortFields.Select(x => x.Key).Contains(sortField.ToLower())) { sortField = sortFields.Where(x => x.Key == sortField).Select(x => x.Value).SingleOrDefault(); } else { sortField = "Id"; } SortField = sortField; Ascending = ascending; }
public IActionResult GetSortFields() { return(Ok(SortingHelper.GetSortFields().Select(x => x.Key))); }