public int getPurchaseItemID(string itemNumber, int itemID, int supplierID)
        {
            Purchase_Item pi          = new Purchase_Item();
            var           qrySupplier = (from i in context.Items
                                         join pItem in context.Purchase_Item on i.ItemID equals pItem.ItemID
                                         join p in context.Purchases on pItem.PurchaseID equals p.PurchaseID
                                         join s in context.Suppliers on pItem.SupplierID equals s.SupplierID
                                         where i.ItemNumber.Equals(itemNumber) && i.ItemID == itemID && pItem.SupplierID == supplierID
                                         select new { pItem.Purchase_ItemID }).FirstOrDefault();

            pi.Purchase_ItemID = qrySupplier.Purchase_ItemID;
            return(pi.Purchase_ItemID);
        }
        public void updatePurchaseItem(int purchaseItemID, int qtyReceived, DateTime date, string itemNumber)
        {
            var           qry = context.Purchase_Item.Where(x => x.Purchase_ItemID == purchaseItemID).FirstOrDefault();
            Purchase_Item pi  = (Purchase_Item)qry;

            pi.QuantityReceived = qtyReceived;
            pi.DateSupplied     = date;

            var qryUpdate = context.Items.Where(x => x.ItemNumber.Equals(itemNumber)).FirstOrDefault();

            qryUpdate.InStockQty += pi.QuantityReceived;
            context.SaveChanges();
        }