public static IQueryable <Descipline> FilterDesciplineBy( this IQueryable <Descipline> desciplines, DesiplineFilterBy filterBy, string filterValue) { if (string.IsNullOrEmpty(filterValue)) { return(desciplines); } switch (filterBy) { case DesiplineFilterBy.NoFilter: return(desciplines); case DesiplineFilterBy.ByFromDictionary: var filterYear = long.Parse(filterValue); return(desciplines.Where( x => x.FormDictionaryLink.Any(s => s.FormDictionaryId == filterYear))); default: throw new ArgumentOutOfRangeException (nameof(filterBy), filterBy, null); } }
public IEnumerable <DropdownTuple> GetFilterDropDownValues(DesiplineFilterBy filterBy) { switch (filterBy) { case DesiplineFilterBy.NoFilter: return(new List <DropdownTuple>()); case DesiplineFilterBy.ByFromDictionary: return(_db.FormDictionaries.Select(v => new DropdownTuple { Value = v.Id.ToString(), Text = $" {v.Code} ({v.Description})" })); default: throw new ArgumentOutOfRangeException(nameof(filterBy), filterBy, null); } }