public ActionResult Delete(Role role)
        {
            if (role == null)
            {
                throw new ArgumentNullException();
            }
            bool?flag = _roles.DeleteRole(role.ID);

            switch (flag)
            {
            case true:
            case null: return(RedirectToAction("ShowAll"));

            case false: ViewData["message"] = "Error.You can't delete role by the reason of availability user with this role"; return(RedirectToAction("Delete", role.ID));
            }
            return(RedirectToAction("ShowAll"));
        }
示例#2
0
        public static void DeleteRole(string roleName)
        {
            IRoles dal = Snitz.Membership.Helpers.Factory <IRoles> .Create("Role");

            dal.DeleteRole(roleName);
        }