Exemplo n.º 1
0
 public OilDeliveryCard(OilDelivery oilDelivery)
 {
     OilDeliveryGuid = oilDelivery.OilDeliveryGuid;
     Supplier = oilDelivery.Supplier;
     Quantity = "bidon".ToQuantity(oilDelivery.QuantityDelivered);
     Cost = oilDelivery.Cost.ToString("C0");
     Date = oilDelivery.DateAdded.FriendlyDateTime();
     Description = oilDelivery.Description;
 }
Exemplo n.º 2
0
        public bool Post(OilDelivery myDelivery)
        {
            using (var db = new StationContext())
            {
                if (myDelivery.OilDeliveryGuid == Guid.Empty) myDelivery.OilDeliveryGuid = Guid.NewGuid();

                myDelivery.DateAdded = DateTime.Now;
                myDelivery.LastEditDate = DateTime.Now;

                db.OilDeliveries.Add(myDelivery);
                return db.SaveChanges() > 0;
            }
        }
Exemplo n.º 3
0
        public bool Put(OilDelivery myDelivery)
        {
            using (var db = new StationContext())
            {
                myDelivery.LastEditDate = DateTime.Now;

                db.OilDeliveries.Attach(myDelivery);
                db.Entry(myDelivery).State = EntityState.Modified;
                return db.SaveChanges() > 0;
            }
        }