Example #1
0
        public async Task <IActionResult> Delete(ChampionshipViewModel championshipViewModel)
        {
            try
            {
                await championshipService.DeleteAsync(championshipViewModel.Id);
            }
            catch (Exception ex)
            {
                ModelState.AddModelError(string.Empty, ex.InnerException?.Message ?? ex.Message);
                ViewData["EntityName"] = "Championship";

                return(View("../Shared/_Delete", championshipViewModel));
            }

            TempData["SuccessMessage"] = "Championship deleted successfully.";

            return(RedirectToAction("Index"));
        }