Example #1
0
        public void Delete(int id)
        {
            ShippingZone shippingZone    = Find(id);
            var          shippingMethods = shippingMethodService.FindAll().Where(m => m.ShippingZoneId == id).ToList();

            foreach (var shippingMethod in shippingMethods)
            {
                shippingMethodService.Delete(shippingMethod.Id);
            }

            db.ShippingZones.Remove(shippingZone);
            db.SaveChanges();
        }
        public ActionResult Index()
        {
            var model = new List <ShippingMethodIndexViewModel>();
            List <ShippingMethod> shippingMethods = shippingMethodService.FindAll().ToList();

            foreach (ShippingMethod zone in shippingMethods)
            {
                var zoneView = Mapper.Map <ShippingMethodIndexViewModel>(zone);

                model.Add(zoneView);
            }

            return(View(model));
        }