public ActionResult Create(User user) { if (ModelState.IsValid && this.userService.CheckDuplicate(user) == false) { this.userService.CreateUser(user); return RedirectToAction("Index"); } ModelState.AddModelError(string.Empty,"Username or Email is taken. They should be uniuqe."); ViewBag.RoleID = new SelectList(db.Roles, "id", "Name", user.RoleID); return View(user); }
public ActionResult Edit(User user) { this.userService.UpdateUser(user); ViewBag.RoleID = new SelectList(db.Roles, "id", "Name", user.RoleID); return View(user); }