Ejemplo n.º 1
0
 public Delivery GetDeliveryById(int deliveryId)
 {
     using (var context = new Data.SwiftDemoContext())
     {
         return context.Set<Delivery>().FirstOrDefault(dp => dp.ID == deliveryId);
     }
 }
Ejemplo n.º 2
0
 public IEnumerable<DeliveryPoint> GetDeliveryPoints()
 {
     using (var context = new Data.SwiftDemoContext())
     {
         return context.Set<DeliveryPoint>().ToList();
     }
 }
Ejemplo n.º 3
0
 public void AddDeliveryPoint(DeliveryPoint deliveryPoint)
 {
     using (var context = new Data.SwiftDemoContext())
     {
         context.Set<DeliveryPoint>().Add(deliveryPoint);
         context.SaveChanges();
     }
 }
Ejemplo n.º 4
0
 public int AddDelivery(Delivery delivery)
 {
     using (var context = new Data.SwiftDemoContext())
     {
         context.Set<Delivery>().Add(delivery);
         context.SaveChanges();
         return delivery.ID;
     }
 }
Ejemplo n.º 5
0
 private IndexViewModel BuildIndexViewModel(int? deliveryId)
 {
     using (var context = new Data.SwiftDemoContext())
     {
         var deliveryPoints = deliveryDataAccessor.GetDeliveryPoints();
         string message = String.Empty;
         if (deliveryId.HasValue)
         {
             var delivery = deliveryDataAccessor.GetDeliveryById(deliveryId.Value);
             message = delivery.BookingMessage;
         }
         return new IndexViewModel{DeliveryPoints = deliveryPoints, Message = message};
     }
 }