public override void Create(PriceHistory item) { Sales.Model.Models.PriceHistory priceHistory = _context.PriceHistories.Find(item.ID); if (priceHistory == null) { _context.PriceHistories.Add(item); } else { throw new ArgumentException("PriceHistory with this ID already exists"); } }
public void Update(PriceHistory item) { Sales.Model.Models.PriceHistory priceHistory = _context.PriceHistories.Find(item.ID); if (priceHistory != null) { priceHistory.Date = item.Date; priceHistory.Price = item.Price; priceHistory.Product_ID = item.Product_ID; _context.Entry <PriceHistory>(priceHistory).State = System.Data.Entity.EntityState.Modified; } else { throw new ArgumentException("PriceHistory with this ID not found"); } }