Exemple #1
0
        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();
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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())));
        }