public IActionResult OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Species = _speciesList.GetById(id); string message = null; if (Species != null) { try { _speciesList.Delete(id); } catch (InvalidOperationException) { message = "Unable to delete species used in patient decription"; } } return(RedirectToPage("Index", "OnGetAsync", new { message })); }
public IActionResult OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Species = _speciesList.GetById(id); if (Species == null) { return(NotFound()); } return(Page()); }