示例#1
0
 ////[Authorize(Roles = "Admin, CanEdit")]
 public ActionResult Edit(string id)
 {
     RolesBusiness rolesB = new RolesBusiness();
     // It's actually the Role.Name tucked into the id param:
     var roleModel = rolesB.GetRole(id);
     return View(roleModel);
 }
示例#2
0
 //[Authorize(Roles = "Admin")]
 public ActionResult Delete(string id)
 {
     RolesBusiness rolesB = new RolesBusiness();
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     var role = rolesB.FirstRole(id);
     var model = new RoleViewModel();//role);
     if (role == null)
     {
         return HttpNotFound();
     }
     return View(model);
 }
示例#3
0
 public ActionResult Create([Bind(Include =
     "RoleName,Description")]RoleViewModel model)
 {
     string message = "That role name has already been used";
     if (ModelState.IsValid)
     {
         RolesBusiness rolesB = new RolesBusiness();
         if (rolesB.Insert(model) != true)
         {
             return View(message);
         }
         else
         {
             return RedirectToAction("Index", "Roles");
         }
     }
     return View();
 }
示例#4
0
        public ActionResult Edit([Bind(Include =
            "RoleName,OriginalRoleName,Description")] EditRoleViewModel model)
        {
            RolesBusiness rolesB = new RolesBusiness();
            if (ModelState.IsValid)
            {
                if (rolesB.Update(model))
                    return RedirectToAction("Index","Roles");

                else
                {
                    return View(model);
                }
            }
            return View(model);
        }
示例#5
0
 public ActionResult DeleteConfirmed(string id)
 {
     RolesBusiness rolesB = new RolesBusiness();
     rolesB.Delete(id);
     return RedirectToAction("Index");
 }
示例#6
0
 //[Authorize(Roles = "Admin")]
 public ActionResult Roleuser(string id)
 {
     RolesBusiness rolesB = new RolesBusiness();
     return View(rolesB.GetRoleUsers(id));
 }
示例#7
0
 //[Authorize(Roles = "Admin")]
 public ActionResult Index()
 {
     RolesBusiness rolesB = new RolesBusiness();
     return View(rolesB.GetAllRoles());
 }