示例#1
0
        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 }));
        }
示例#2
0
        public IActionResult OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Species = _speciesList.GetById(id);

            if (Species == null)
            {
                return(NotFound());
            }
            return(Page());
        }