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(); } }
public ActionResult AddRole(Role role) { ServiceUserRepository.Instance.AddRole(role); return Json(false); }
public ActionResult DeleteRole(Role role) { ServiceUserRepository.Instance.DeleteRole(role.Id); return Json(false); }