コード例 #1
0
 public ActionResult UserAdd(User user)
 {
     if (ModelState.IsValid && irep.GetUser(user.User_Name).User_Name == null)
     {
         if (irep.AddUser(user))
         {
             Session["userName"] = user.User_Name;
             return(RedirectToAction("RoleChoose"));
         }
         else
         {
             return(View());
         }
     }
     else
     {
         ModelState.AddModelError("", "用户名已存在");
         return(View());
     }
 }