public ActionResult Edit(KotUser usr) { KotUser user = KotUser.GetById(usr.ID); if (user == null) { return RedirectToAction("Index", "Error", new { id = (int)RoomsExceptions.NONEXISTENT_USER }); } if (!Request.IsAuthenticated || usr.ID.ToString() != User.Identity.Name) { return RedirectToAction("Index", "Error", new { id = (int)RoomsExceptions.UNAUTHORIZED_EDIT }); } if (ModelState.IsValidField("Email") && ModelState.IsValidField("Phone")) { user.UpdateInfo(usr.Email, usr.Phone); return RedirectToAction("Index", "Users", new { id = usr.ID }); } ViewBag.Edit = true; /* Content */ ViewBag.User = user; ViewBag.ReservedRooms = user.GetReserved(); ViewBag.Advertised = user.GetRooms(RoomSorts.Toegevoegd, false, 0, ROOMS_PER); /* Pagination */ int pages = (user.GetRooms(RoomSorts.Toegevoegd, false).Count - 1) / ROOMS_PER + 1; ViewBag.Page = 1; ViewBag.LastPage = pages; ViewBag.Pages = Enumerable.Range(1, pages).ToList(); /* Sorting */ ViewBag.Sort = RoomSorts.Toegevoegd; ViewBag.Reversed = false; ViewBag.Sorts = Enum.GetValues(typeof(RoomSorts)); return View("Index", user); }
partial void DeleteKotUser(KotUser instance);
partial void UpdateKotUser(KotUser instance);
partial void InsertKotUser(KotUser instance);