예제 #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());
 }