public ActionResult Create([Bind(Include = "RoleName,Description")]RoleViewModel model) { string message = "That role name has already been used"; if (ModelState.IsValid) { var role = new ApplicationRole(model.RoleName, model.Description); var idManager = new IdentityManager(); if(idManager.RoleExists(model.RoleName)) { return View(message); } else { idManager.CreateRole(model.RoleName, model.Description); return RedirectToAction("Index", "Account"); } } return View(); }
public ActionResult DeleteConfirmed(string id) { var role = _db.Roles.First(r => r.Name == id); var idManager = new IdentityManager(); idManager.DeleteRole(role.Id); return RedirectToAction("Index"); }