public ActionResult Create(Role role)
 {
     if (ModelState.IsValid)
     {
         roleRepository.InsertOrUpdate(role);
         roleRepository.Save();
         Success("\u4fdd\u5b58\u6210\u529f\uff01");
         return RedirectToAction("Index");
     }
     else
     {
         Error("\u4fdd\u5b58\u5931\u8d25\uff0c\u8868\u5355\u4e2d\u5b58\u5728\u4e00\u4e9b\u9519\u8bef\uff01");
         return View();
     }
 }
 public override void CreateRole(string roleName)
 {
     if (string.IsNullOrEmpty(roleName))
     {
         throw CreateArgumentNullOrEmptyException("roleName");
     }
     using (WebApp4Context context = new WebApp4Context())
     {
         dynamic role = context.Role.FirstOrDefault(Rl => Rl.RoleName == roleName);
         if (role != null)
         {
             throw new InvalidOperationException(string.Format("Role exists: {0}", roleName));
         }
         Role NewRole = new Role
         {
             //Id = Guid.NewGuid(),
             RoleName = roleName
         };
         NewRole.GenerateNewIdentity();
         context.Role.Add(NewRole);
         context.SaveChanges();
     }
 }