Ejemplo n.º 1
0
 public ActionResult SmileIndex(int page = 1)
 {
     PageInfo pagingInfo = new PageInfo { CurrentPage = page, ItemsPerPage = pageSize, TotalItems = repo.SmileFrownCount() };
     SmileListViewModel model = new SmileListViewModel { Smiles = repo.getAllSmiles(pageSize, (page - 1) * pageSize), PagingInfo = pagingInfo };
     return View(model);
 }
 public ActionResult Smiles(string userName, int orgId, int? pointId, int page = 1)
 {
     if (!authRepo.userCanManageOrg(userName, orgId))
     {
         return RedirectToAction(actionName: "LogOn", controllerName: "Account");
     }
     ViewBag.userChangeContent = authRepo.hasOrgContentWritePermissions(userName, orgId);
     repo.initialize(orgId);
     ViewBag.organizationName = repo.orgName();
     ViewBag.organizationID = orgId.ToString();
     PageInfo pagingInfo;
     List<Smile> listSmiles;
     if (pointId != null)
     {
         listSmiles = repo.getAllSmiles(pageSize, (page - 1) * pageSize, (int)pointId, true, false).ToList();
         pagingInfo = new PageInfo { CurrentPage = page, ItemsPerPage = pageSize, TotalItems = listSmiles.Count() };
     }
     else
     {
         listSmiles = repo.getAllSmiles(pageSize, (page - 1) * pageSize, true, false).ToList();
         pagingInfo = new PageInfo { CurrentPage = page, ItemsPerPage = pageSize, TotalItems = listSmiles.Count() };
     }
     SmileListViewModel model = new SmileListViewModel { Smiles = listSmiles, PagingInfo = pagingInfo };
     return View(model);
 }