Пример #1
0
        public ActionResult Delete(UserRoleDelete value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            var role = this.UserRoleService.GetById(value.Id);

            if (role == null)
            {
                return base.HttpNotFound();
            }

            var privilege = new UserRolePrivilege();

            if (!privilege.CanDelete(role))
            {
                return NotAuthorized();
            }

            this.UserRoleService.Delete(role);

            return base.RedirectToRoute(UsersAdministrationRoutes.RoleIndex);
        }
Пример #2
0
        public ActionResult Delete(int id)
        {
            var role = this.UserRoleService.GetById(id);

            if (role == null)
            {
                return base.HttpNotFound();
            }

            var privilege = new UserRolePrivilege();

            return privilege.CanDelete(role) ? base.View(Views.Delete, new UserRoleDelete(role)) : NotAuthorized();
        }