public ActionResult AddRole(string name) { if (name == "") { ViewBag.Result = "Please enter Role Name."; } else { bool found = rb.RoleExists(name); if (found == true) { ViewBag.Result = "Role name " + name + " already exists."; } else { rb.CreateRole(name); ViewBag.Result = "Role created successfully."; return(RedirectToAction("Index")); } } return(View()); }
public ActionResult AddRole(string name) { if (name == "") { ViewBag.Result = "Please enter Role Name."; } else { bool found = rb.RoleExists(name); if (found == true) { ViewBag.Result = "Role name " + name + " already exists."; } else { rb.CreateRole(name); ViewBag.Result = "Role created successfully."; return(Json(new { success = true, message = "Saved Successfully" }, JsonRequestBehavior.AllowGet)); } } return(View()); }