public virtual IActionResult StateDelete(int id) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageCountries)) { return(AccessDeniedView()); } var state = _stateProvinceService.GetStateProvinceById(id); if (state == null) { throw new ArgumentException("No state found with the specified id"); } if (_addressService.GetAddressTotalByStateProvinceId(state.Id) > 0) { return(Json(new DataSourceResult { Errors = _localizationService.GetResource("Admin.Configuration.Countries.States.CantDeleteWithAddresses") })); } //int countryId = state.CountryId; _stateProvinceService.DeleteStateProvince(state); //activity log _customerActivityService.InsertActivity("DeleteStateProvince", string.Format(_localizationService.GetResource("ActivityLog.DeleteStateProvince"), state.Id), state); return(new NullJsonResult()); }
public ActionResult StateDelete(int id, GridCommand command) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageCountries)) { return(AccessDeniedView()); } var state = _stateProvinceService.GetStateProvinceById(id); if (state == null) { throw new ArgumentException("No state found with the specified id"); } if (_addressService.GetAddressTotalByStateProvinceId(state.Id) > 0) { return(Content(_localizationService.GetResource("Admin.Configuration.Countries.States.CantDeleteWithAddresses"))); } int countryId = state.CountryId; _stateProvinceService.DeleteStateProvince(state); return(States(countryId, command)); }
public IActionResult StateDelete(string id) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageCountries)) { return(AccessDeniedView()); } var state = _stateProvinceService.GetStateProvinceById(id); if (state == null) { throw new ArgumentException("No state found with the specified id"); } if (_addressService.GetAddressTotalByStateProvinceId(state.Id) > 0) { return(Json(new DataSourceResult { Errors = _localizationService.GetResource("Admin.Configuration.Countries.States.CantDeleteWithAddresses") })); } _stateProvinceService.DeleteStateProvince(state); return(new NullJsonResult()); }
public ActionResult Delete() { bool status = false; string message = ""; if (Request.Form.Count > 0) { var models = JsonConvert.DeserializeObject <List <StateProvinceWBModel> >(Request.Form[0]); if (models != null) { var model = models[0]; var stateProvince = _stateProvinceService.GetStateProvinceById(model.Id); if (stateProvince != null && stateProvince != null) { var stateProvinceWB = _stateProvinceWBService.GetStateProvinceWBsByStateProvinceId(stateProvince.Id); if (stateProvinceWB != null) { _stateProvinceWBService.Delete(stateProvinceWB); } _stateProvinceService.DeleteStateProvince(stateProvince); } } } return(Json(new { Status = status, Message = message })); }
public ActionResult DeleteConfirmed(int id) { var stateProvince = _stateProvinceService.GetStateProvinceById(id); _stateProvinceService.DeleteStateProvince(stateProvince); _unitOfWork.Commit(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { var stateProvince = _stateProvinceService.GetStateProvinceById(id); if (stateProvince != null) { _stateProvinceService.DeleteStateProvince(stateProvince); } return(Content("Deleted")); }
public async Task <IActionResult> DeleteStateProvince(int id) { var stateProvince = await _stateProvinceService.GetStateProvinceById(id); if (stateProvince == null) { return(NotFound()); } await _stateProvinceService.DeleteStateProvince(stateProvince); return(NoContent()); }
public ActionResult StateDelete(int valueId, GridCommand command) { var state = _stateProvinceService.GetStateProvinceById(valueId); var countryId = state.CountryId; if (_addressService.GetAddressTotalByStateProvinceId(state.Id) > 0) { return(Content(T("Admin.Configuration.Countries.States.CantDeleteWithAddresses"))); } _stateProvinceService.DeleteStateProvince(state); return(States(countryId, command)); }
public ActionResult StateDelete(int id, GridCommand command) { var state = _stateProvinceService.GetStateProvinceById(id); var countryId = state.CountryId; if (_services.Permissions.Authorize(StandardPermissionProvider.ManageCountries)) { if (_addressService.GetAddressTotalByStateProvinceId(state.Id) > 0) { return(Content(T("Admin.Configuration.Countries.States.CantDeleteWithAddresses"))); } _stateProvinceService.DeleteStateProvince(state); } return(States(countryId, command)); }
public ActionResult StateDelete(int id, GridCommand command) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageCountries)) return AccessDeniedView(); var state = _stateProvinceService.GetStateProvinceById(id); if (state == null) throw new ArgumentException("No state found with the specified id"); if (_addressService.GetAddressTotalByStateProvinceId(state.Id) > 0) return Content("The state can't be deleted. It has associated addresses"); int countryId = state.CountryId; _stateProvinceService.DeleteStateProvince(state); return States(countryId, command); }
public ActionResult StateDelete(int id, GridCommand command) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageCountries)) { return(AccessDeniedView()); } var state = _stateProvinceService.GetStateProvinceById(id); if (_addressService.GetAddressTotalByStateProvinceId(state.Id) > 0) { return(Content("The state can't be deleted. It has associated addresses")); } int countryId = state.CountryId; _stateProvinceService.DeleteStateProvince(state); return(States(countryId, command)); }
public IActionResult StateDelete(string id) { var state = _stateProvinceService.GetStateProvinceById(id); if (state == null) { throw new ArgumentException("No state found with the specified id"); } if (_addressService.GetAddressTotalByStateProvinceId(state.Id) > 0) { return(Json(new DataSourceResult { Errors = _localizationService.GetResource("Admin.Configuration.Countries.States.CantDeleteWithAddresses") })); } if (ModelState.IsValid) { _stateProvinceService.DeleteStateProvince(state); return(new NullJsonResult()); } return(ErrorForKendoGridJson(ModelState)); }
/// <summary> /// Deletes a state/province /// </summary> /// <param name="stateProvince">The state/province</param> void DeleteStateProvince(StateProvince stateProvince) { _stateProvinceService.DeleteStateProvince(stateProvince); }