public ActionResult Index(PrizeListFiltersModel filters) { int pageTotal; var prizes = _prizeService.GetAll("CreatedDate", "DESC", filters.Criteria, filters.MaxPointsNeeded, filters.Page, DefaultPageSize, out pageTotal); var pagedList = new StaticPagedList <PrizeDto>(prizes, filters.Page, DefaultPageSize, pageTotal); var listModel = new PrizeListModel(pagedList, filters); return(View(listModel)); }
public ActionResult Index(PrizeListFiltersModel filters) { int pageTotal; int?maxPointsNeeded = filters.WithinReach ? _currentUser.Beneficiary.Points : (int?)null; var prizes = _prizeService.GetAll("CreatedDate", "DESC", filters.Criteria, maxPointsNeeded, filters.Page, DefaultPageSize, out pageTotal); var pagedList = new StaticPagedList <PrizeDto>(prizes, filters.Page, DefaultPageSize, pageTotal); var listModel = new PrizeListModel(pagedList, filters); return(View(listModel)); }
public ActionResult AddPrize(PrizeListFiltersModel filters, int sectionId) { var section = _sectionService.GetById(sectionId); int pageTotal = 0; var benefits = _prizeService.GetAll("CreatedDate", "DESC", filters.Criteria, filters.MaxPointsNeeded, filters.Page, DefaultPageSize, out pageTotal); var pagedList = new StaticPagedList <PrizeDto>(benefits, filters.Page, DefaultPageSize, pageTotal); var listModel = new PrizeListModel(pagedList, filters); var sectionItems = _sectionItemService.GetBySectionId(sectionId); var addPrizeModel = new AddPrizeModel(); addPrizeModel.SectionName = section.Name; addPrizeModel.PrizeListModel = listModel; addPrizeModel.SelectedPrizeIds = sectionItems.Where(si => si.PrizeId.HasValue).Select(si => si.PrizeId.GetValueOrDefault()).ToList(); addPrizeModel.SectionId = sectionId; return(View(addPrizeModel)); }