public ActionResult DeleteUser(string userID, bool confirmed) { if (confirmed == false) { // If deletion has not been confirmed by admin, request confirmation return(RedirectToAction("ConfirmDeleteUser", "Account", new { userID = userID })); } else { // If deletion is confirmed, then delete user records from the databases var userManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(new ApplicationDbContext())); ApplicationUser foundUser = userManager.FindById(userID); userManager.Delete(foundUser); // Delete from identity database UserQuery userQuery = new UserQuery(); userQuery.DeleteUser(userID); // Delete from application database return(RedirectToAction("ShowUsers", "Account")); } }
public static void HapusUser(string _username) { UserQuery.DeleteUser(_username); }