// GET: ActivityDatas/Manage public ActionResult Manage(int? page) { int pageNumber = (page ?? 1); string userId = User.Identity.GetUserId(); var data = dataService.FindActivityDataForUser(userId); var categories = categoryUnitService.CreateCategoryUnitList(); ViewBag.categoryUnits = new SelectList(categories, "idCategoryUnit", "unit", "category", 0); ActivityDataListViewModel model = new ActivityDataListViewModel(); model.Data = data.ToPagedList(pageNumber, pageSize); model.FilterParams = new FilterViewModel(); return View(model); }
public ActionResult Manage(int? page, FilterViewModel filterParams) { string userId = User.Identity.GetUserId(); ApplicationUser user = db.Users.Where(u => u.Id.Equals(userId)).Single(); if (user == null) { return new HttpStatusCodeResult(HttpStatusCode.Unauthorized); } filterParams.Email = user.Email; var activityData = dataService.Filter(filterParams); int pageNumber = (page ?? 1); var categories = categoryUnitService.CreateCategoryUnitList(); ViewBag.categoryUnits = new SelectList(categories, "idCategoryUnit", "unit", "category", 0); ActivityDataListViewModel model = new ActivityDataListViewModel(); model.Data = activityData.ToPagedList(pageNumber, pageSize); model.FilterParams = filterParams; //note: must manually redirect view here because of the MultipleButton annotation. return View("Manage", model); }
public ActionResult Index(int? page, FilterViewModel filterParams) { var activityData = dataService.Filter(filterParams); int pageNumber = (page ?? 1); var categories = categoryUnitService.CreateCategoryUnitList(); ViewBag.categoryUnits = new SelectList(categories, "idCategoryUnit", "unit", "category", 0); ActivityDataListViewModel model = new ActivityDataListViewModel(); model.Data = activityData.ToPagedList(pageNumber, pageSize); model.FilterParams = filterParams; return View("Index", model); }