public DashboardIndexFiltered GetFilteredAndSortedDasboard(IndexBody model) { var dashboardThreads = GetDashboard(model); IPagedList <DashboardVM> threads = Sort(dashboardThreads, model.CurrentSort).ToPagedList(model.Page, model.ItemsPerPage ?? ConstantsRepo.PAGE_SIZE); DashboardIndexFiltered result = new DashboardIndexFiltered() { ItemStart = (threads.PageNumber - 1) * threads.PageSize + 1, ItemEnd = threads.PageNumber * threads.PageSize < threads.TotalItemCount ? threads.PageNumber * threads.PageSize : threads.TotalItemCount, PageCount = threads.PageCount, PageNumber = threads.PageNumber, TotalItemsCount = threads.TotalItemCount, Threads = threads.ToList(), IDSort = model.CurrentSort == ConstantsRepo.SORT_NOTIFICATION_BY_ID_ASCE ? ConstantsRepo.SORT_NOTIFICATION_BY_ID_DESC : ConstantsRepo.SORT_NOTIFICATION_BY_ID_ASCE, SubjectSort = model.CurrentSort == ConstantsRepo.SORT_NOTIFICATION_BY_HEADING_DESC ? ConstantsRepo.SORT_NOTIFICATION_BY_HEADING_ASCE : ConstantsRepo.SORT_NOTIFICATION_BY_HEADING_DESC, SenderSort = model.CurrentSort == ConstantsRepo.SORT_NOTIFICATION_BY_SENDER_DESC ? ConstantsRepo.SORT_NOTIFICATION_BY_SENDER_ASCE : ConstantsRepo.SORT_NOTIFICATION_BY_SENDER_DESC, DateSort = model.CurrentSort == ConstantsRepo.SORT_NOTIFICATION_BY_DATE_DESC ? ConstantsRepo.SORT_NOTIFICATION_BY_DATE_ASCE : ConstantsRepo.SORT_NOTIFICATION_BY_DATE_DESC, LevelOfImpactSort = model.CurrentSort == ConstantsRepo.SORT_LEVEL_OF_IMPACT_DESC ? ConstantsRepo.SORT_LEVEL_OF_IMPACT_ASCE : ConstantsRepo.SORT_LEVEL_OF_IMPACT_DESC, }; return(result); }
// POST: api/Dashboard public DashboardIndexFiltered Post([FromBody] IndexBody model) { DashboardIndexFiltered result = _dApiRepo.GetFilteredAndSortedDasboard(model); return(result); }