IPaginable <Period> IRequestHandler <PeriodsSearchableDatabaseQuery, IPaginable <Period> > .Handle(PeriodsSearchableDatabaseQuery message) { if (string.IsNullOrWhiteSpace(message.QueryText)) { var query = new PeriodsPaginableDatabaseQuery { PageNumber = message.PageNumber, ItemCountPerPage = message.ItemCountPerPage, }; return(this.mediator.Send(query)); } var paginable = this.dbContext.Periods .Where(t => t.MonthName.Contains(message.QueryText) || t.WeekdayName.Contains(message.QueryText)) .OrderBy(t => t.PeriodID) .ToPaginable(message.PageNumber, message.ItemCountPerPage); return(paginable); }
IPaginable <Period> IRequestHandler <PeriodsPaginableDatabaseQuery, IPaginable <Period> > .Handle(PeriodsPaginableDatabaseQuery message) { var paginable = this.dbContext.Periods .OrderBy(t => t.PeriodID) .ToPaginable(message.PageNumber, message.ItemCountPerPage); return(paginable); }