public ActionResult EditRole(Role model) { if (model != null) { userService.UpdateRole(model); return Json(true, JsonRequestBehavior.AllowGet); } return Json(false, JsonRequestBehavior.AllowGet); }
public ActionResult CreateRole(Role model) { if (model != null) { model.Id = Guid.NewGuid().ToString(); userService.CreateRole(model); return Json(true, JsonRequestBehavior.AllowGet); } return Json(false, JsonRequestBehavior.AllowGet); }
/// <summary> /// Update role /// </summary> /// <param name="role"></param> public void UpdateRole(Role role) { role.UserRoles = null; roleRepository.Update(role); }
public void CreateRole(Role role) { roleRepository.Add(role); }
/// <summary> /// Update a role /// </summary> /// <param name="role"></param> public void DeleteRole(Role role) { using (var dbContext = new DatabaseContext()) { var rDel = dbContext.Roles.FirstOrDefault(r => r.Id.Equals(role.Id)); if (rDel != null) { dbContext.Roles.Remove(rDel); dbContext.SaveChanges(); } } }