public async Task <IActionResult> DeleteConfirmed(int id) { if (_api.DeleteUser(id)) { return(RedirectToAction(nameof(Index))); } else { User u = _api.GetUserById(id); ModelState.AddModelError(string.Empty, "User couldn't be deleted"); return(View(u)); } }