Пример #1
0
 public ActionResult Details()
 {
     List<DeliveryDetailsDomain> deliveries = new List<DeliveryDetailsDomain>();
     using (IDeliveryService service = new DeliveryService())
     {
         deliveries = service.GetStuffThatHasBeenDelivered();
     }
     
     return View("Index");
 }
        public void Details(DeliveryDetailsViewModel data)
        {
            if (ModelState.IsValid)
            {
                // Could look at doing this with AutoMapper or some other mapping tool, 
                // but I've over engineered this already :)
                DomainStuffIncludingDeliveryDetails model = new DomainStuffIncludingDeliveryDetails();
                model.FirstOfManyDeliveries = new DeliveryDetailsDomain
                {
                    Name = data.Name,
                    Address = data.Address,
                    Phone = data.Phone
                };

                using (IDeliveryService service = new DeliveryService())
                {
                    service.SaveDeliveryDetails(model.FirstOfManyDeliveries);
                }
            }
        }
        public List<DeliveryDetailsDomain> Details()
        {
            List<DeliveryDetailsDomain> deliveries = new List<DeliveryDetailsDomain>();
            using (IDeliveryService service = new DeliveryService())
            {
                deliveries = service.GetStuffThatHasBeenDelivered();
            }

            return deliveries;
        }