public void Delete(int id) { TaxZone taxZone = Find(id); var taxRates = taxRateService.FindByZone(id).ToList(); foreach (var taxRate in taxRates) { taxRateService.Delete(taxRate.Id); } db.TaxZones.Remove(taxZone); db.SaveChanges(); }
public IActionResult DeleteTaxRate(int taxRateId) { var taxRate = taxRateId > 0 ? _taxRateService.Get(taxRateId) : null; if (taxRate == null) { return(NotFound()); } _taxRateService.Delete(taxRate); return(R.Success.Result); }
public ActionResult DeleteConfirmed(int[] ids) { if (ids == null || !ids.Any()) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } foreach (int id in ids) { taxRateService.Delete(id); } return(RedirectToAction("Index") .WithWarning(string.Format("The tax rate has been deleted".TA()))); }