public async Task <JsonResult> DeleteCountry(int countryId) { JsonData <JsonStatus> data = new JsonData <JsonStatus>(new JsonStatus()); if (true == await _country.DeleteCountry(countryId)) { data.Result.Status = true; } return(Json(data)); // returns. }
public ActionResult DeleteCountry(int id) { try { DeleteCountry deleteCountry = new DeleteCountry(); deleteCountry.CountryId = id; int result = iCountry.DeleteCountry(deleteCountry); return(Json(result)); } catch (Exception ex) { throw ex; } }
public ActionResult DeleteConfirmed(int id) { try { Country country = countryRepository.GetCountryById(id); countryRepository.DeleteCountry(id); countryRepository.Save(); } catch (DataException) { return(RedirectToAction("Delete", new { id = id, saveChangesError = true })); } return(RedirectToAction("Index")); }