Exemple #1
0
 public ActionResult addRole(AdminRole adminrole)
 {
     if (ModelState.IsValid)
     {
         if (adminRolebll.Exist(adminrole.RoleName))
         {
             ModelState.AddModelError("RoleName", "角色名称已存在");
         }
         else
         {
             AdminRole _adminRole = new AdminRole()
             {
                 RoleName    = adminrole.RoleName,
                 RolePower   = adminrole.RolePower,
                 Description = adminrole.Description
             };
             _adminRole = adminRolebll.Add(_adminRole);
             if (_adminRole.Id > 0)
             {
                 return(RedirectToAction("listRole"));
             }
             else
             {
                 ModelState.AddModelError("", "添加失败!");
             }
         }
     }
     return(View("add"));
 }