public SortingFilter(string sortField, bool ascending) { var sortFields = SortingHelper.GetSortField(); 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.GetSortField().Select(x => x.Key))); }