public ActionResult Delete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var user = UserManager.FindById(id); if (user == null) { return(HttpNotFound()); } GroupManager.ClearUserGroups(id); var result = UserManager.Delete(user); if (!result.Succeeded) { ModelState.AddModelError("Error", result.Errors.First()); } return(RedirectToAction("Index")); }
public IHttpActionResult DeleteUser(string id) { if (id == null) { return(NotFound()); } var user = UserManager.FindById(id); if (user == null) { return(NotFound()); } GroupManager.ClearUserGroups(id); var result = UserManager.Delete(user); if (!result.Succeeded) { ModelState.AddModelError("Error", result.Errors.First()); } return(Ok(user)); }