public async Task <IActionResult> DeleteConfirmed(int id) { var groups = await _servGroups.DeleteConfirmedAsync(id); if (groups != null) { ViewData["ErrorMessage"] = "Delete failed. This group is not empty. Transfer students to a different group " + "and try again."; return(View(groups)); } return(RedirectToAction(nameof(Index))); }