public async Task <IActionResult> Delete(int id)
        {
            try
            {
                await nationalityService.DeleteNationality(id);

                return(Ok("Nationality successfully deleted!"));
            }
            catch (Exception)
            {
                return(NotFound());
            }
        }
Beispiel #2
0
        public ActionResult Delete(int id)
        {
            DeleteNationalityRequest request = new DeleteNationalityRequest()
            {
                NationalityId = id
            };
            DeleteNationalityResponse response = _nationalityService.DeleteNationality(request);

            if (response.Success)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                NationalityListPageViewModel model = new NationalityListPageViewModel();
                model.Success = false;
                model.Message = response.Message;
                return(View("Index", model));
            }
        }
 public ActionResult Delete(int id)
 {
     _nationalityService.DeleteNationality(id);
     return(RedirectToAction("Index"));
 }