コード例 #1
0
        public ProductInventory Delete(int id)
        {
            ProductInventory product = context.ProductsInventorys.Find(id);

            if (product != null)
            {
                context.ProductsInventorys.Remove(product);
                context.SaveChanges();
            }
            return(product);
        }
コード例 #2
0
        public ProductInventory Update(ProductInventory productInventoryChanges)
        {
            ProductInventory productInventory = _productInventoryList.FirstOrDefault(p => p.ProdInvId == productInventoryChanges.ProdInvId);

            if (productInventory != null)
            {
                productInventory.ProdInvName = productInventoryChanges.ProdInvName;
                productInventory.Description = productInventoryChanges.Description;
                productInventory.Quantity    = productInventoryChanges.Quantity;
                productInventory.UnitPrice   = productInventoryChanges.UnitPrice;
            }
            return(productInventory);
        }
コード例 #3
0
 public ProductInventory Add(ProductInventory productInventory)
 {
     productInventory.ProdInvId = _productInventoryList.Max(p => p.ProdInvId) + 1;
     _productInventoryList.Add(productInventory);
     return(productInventory);
 }
コード例 #4
0
 public ProductInventory Add(ProductInventory productInventory)
 {
     context.ProductsInventorys.Add(productInventory);
     context.SaveChanges();
     return(productInventory);
 }