public void AddRole(RoleW role, string[] features) { role.Id = Guid.NewGuid(); Db.Roles.Add(role.ToBase()); MakeRoleFeatureConnections(role.Id, features); Db.SaveChanges(); }
public void EditRole(RoleW roleW, string[] features) { var role = this.GetBaseRole(roleW.Id); role.DisplayName = roleW.DisplayName; MakeRoleFeatureConnections(role.Id, features); Db.SaveChanges(); }
public ActionResult Edit([Bind(Include = "Id,DisplayName")] RoleW role, string[] features) { if (ModelState.IsValid) { Rep.EditRole(role, features); return(RedirectToAction("Index")); } return(View(role)); }
public ActionResult Edit(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RoleW role = Rep.GetRole(id.Value); if (role == null) { return(HttpNotFound()); } ViewBag.Features = Rep.GetFeatures(); return(View(role)); }
public ActionResult Delete(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RoleW role = Rep.GetRole(id.Value); if (role == null) { return(HttpNotFound()); } if (Request.IsAjaxRequest()) { return(PartialView(role)); } return(View(role)); }