public void AddRole(Role role)
 {
     using (var currentContext = new PizzaSericeContext())
     {
         currentContext.Roles.Add(role);
         currentContext.SaveChanges();
     }
 }
 public void EditUserRole(int userId, Role role)
 {
     using (var context = new PizzaSericeContext())
     {
         ServiceUser user = GetUserById(userId);
         user.RoleId = role.Id;
         context.ServiceUsers.Attach(user);
         context.Entry(user).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
Example #3
0
 public ActionResult AddRole(Role role)
 {
     ServiceUserRepository.Instance.AddRole(role);
     return Json(false);
 }
Example #4
0
 public ActionResult DeleteRole(Role role)
 {
     ServiceUserRepository.Instance.DeleteRole(role.Id);
     return Json(false);
 }