public async Task <List <Meeting> > GetAsync([AllowNull] MeetingGetParams meetingGetParams) { if (meetingGetParams == null) { var list = await FullList(meetingGetParams); if (list != null) { return(list); } } return(await OptionList(meetingGetParams)); }
private async Task <List <Meeting> > FullList(MeetingGetParams meetingGetParams) { if (meetingGetParams == null || meetingGetParams.Department == null && meetingGetParams.Duration == TimeSpan.Zero && meetingGetParams.FirstName == null && meetingGetParams.IssueDescription == null && meetingGetParams.LastName == null && meetingGetParams.ReasonDescription == null && meetingGetParams.Type == null) { return(await RenderList()); } return(await OptionList(meetingGetParams)); }
private async Task <List <Meeting> > OptionList(MeetingGetParams meetingGetParams) { return(await _context.Meetings .Where(x => x.Date.StartingDate == meetingGetParams.StartingDate || x.Date.Duration == meetingGetParams.Duration || x.Issue.Description == meetingGetParams.IssueDescription || x.Issue.Type == meetingGetParams.Type || x.Person.FirstName == meetingGetParams.FirstName || x.Person.LastName == meetingGetParams.LastName || x.Person.Department == meetingGetParams.Department) .OrderBy(x => x.Date.StartingDate) .Include(x => x.Date) .Include(x => x.Issue) .Include(x => x.Person).ToListAsync()); }