コード例 #1
0
        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.
        }
コード例 #2
0
 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;
     }
 }
コード例 #3
0
        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"));
        }