public void UpdateBuyerBid(int buyerBidId, BuyerBids buyerBid) { var buyerBidExists = _RTSystemContext.BuyerBids.FirstOrDefault(n => n.BuyerBidId == buyerBidId); if (buyerBidExists != null) { if (buyerBid.Quality != null) { buyerBidExists.Quality = buyerBid.Quality; } if (buyerBid.Quantity != 0.00) { buyerBidExists.Quantity = buyerBid.Quantity; } if (buyerBid.Price != 0.00) { buyerBidExists.Price = buyerBid.Price; } if (buyerBid.PaymentIn != null) { buyerBidExists.PaymentIn = buyerBid.PaymentIn; } if (buyerBid.Status != null) { buyerBidExists.Status = buyerBid.Status; } _RTSystemContext.SaveChanges(); } else { throw new Exception("Failed to Update"); } }
public void CreateBuyerBid(BuyerBids buyerBid) { if (buyerBid.Quality == null || buyerBid.PaymentIn == null) { throw new Exception("Incomplete Fields"); } else { _RTSystemContext.BuyerBids.Add(buyerBid); _RTSystemContext.SaveChanges(); } }