Ejemplo n.º 1
0
        //[AuthLog(Groups = "UserAdmins,SuperAdmins,DevOpsAdmins,OrgnAdmins", Roles = "Admin, CanEditUser,CanEditOrgLevels")]
        public ActionResult DeleteConfirmed(string id)
        {
            var user = _db.Users.First(u => u.UserName == id);

            _db.Users.Remove(user);
            _db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public void DeleteRole(string roleId)
        {
            IQueryable <ApplicationUser> roleUsers = _db.Users.Where(u => u.Roles.Any(r => r.RoleId == roleId));
            ApplicationRole role = _db.Roles.Find(roleId);

            foreach (ApplicationUser user in roleUsers)
            {
                RemoveFromRole(user.Id, role.Name);
            }
            _db.Roles.Remove(role);
            _db.SaveChanges();
        }