예제 #1
0
 //MAPPING INVENTORY
 //Entity-->Data object
 public static Library.Inventory MapEFWithInventory(Entities.Inventory EInventory)
 {
     return(new Library.Inventory
     {
         Quantity = EInventory.Quantity,
         LID = EInventory.Lid,
         PID = EInventory.Pid
     });
 }
예제 #2
0
        public void DecrementInventory(string product, int storeId)
        {
            _logger.LogInformation("Decrementing Inventory with Product {product}, from store with Id {storeId}", product, storeId);

            Entities.Inventory entity = _dbContext.Inventory
                                        .Where(p => p.Product == product && p.StoreId == storeId)
                                        .SingleOrDefault();

            entity.Quantity -= 1;
        }
예제 #3
0
        public void AddToOrder(int orderId, int prodId)
        {
            Entities.CurrentOrder order = _dbContext.CurrentOrder
                                          .First();
            Entities.Inventory product = _dbContext.Inventory
                                         .Where(p => p.Id == prodId).SingleOrDefault();

            order.Order      += product.Product + " + ";
            order.TotalPrice += product.Price;

            _dbContext.SaveChanges();

            return;
        }