コード例 #1
0
 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);
 }
コード例 #2
0
 public ActionResult Edit(User user)
 {
     this.userService.UpdateUser(user);
     ViewBag.RoleID = new SelectList(db.Roles, "id", "Name", user.RoleID);
     return View(user);
 }