public static IQueryable <Models.TraineeshipPayment> FilterTraineeshipPaymentBy(this IQueryable <Models.TraineeshipPayment> pilots, TraineeshipPaymentsFilters filterBy, TraineeshipPaymentSSFP options) { switch (filterBy) { case TraineeshipPaymentsFilters.NoFilter: return(pilots); case TraineeshipPaymentsFilters.Traineeship: return(pilots .Where(tp => tp.TraineeshipID == options.TraineeshipId)); case TraineeshipPaymentsFilters.Pilot: return(pilots .Where(tp => tp.PilotID == options.PilotId)); default: throw new ArgumentOutOfRangeException (nameof(filterBy), filterBy, null); } }
public static IQueryable <Models.TraineeshipPayment> SearchTraineeshipPaymentBy(this IQueryable <Models.TraineeshipPayment> TraineeshipPayment, TraineeshipPaymentSSFP options) { if (string.IsNullOrWhiteSpace(options.UserInput)) { return(TraineeshipPayment); } return(TraineeshipPayment .Where(p => TraineeshipPayment.Any(TraineeshipPayment => p.Pilot.LastName.Contains(options.UserInput)))); }