Example #1
0
        public async Task <IActionResult> CreateProductListPriceHistory([FromBody] Production.ProductListPriceHistory value)
        {
            _db.Production_ProductListPriceHistory.Add(value);
            await _db.SaveChangesAsync();

            return(Ok(value));
        }
Example #2
0
        public async Task <IActionResult> EditProductListPriceHistory(int productID, DateTime startDate, [FromBody] Production.ProductListPriceHistory value)
        {
            var existing = await _db.Production_ProductListPriceHistory.FirstOrDefaultAsync(x => x.ProductID == productID && x.StartDate == startDate);

            if (existing == null)
            {
                return(NotFound());
            }

            existing.ProductID    = value.ProductID;
            existing.StartDate    = value.StartDate;
            existing.EndDate      = value.EndDate;
            existing.ListPrice    = value.ListPrice;
            existing.ModifiedDate = value.ModifiedDate;

            _db.Production_ProductListPriceHistory.Update(existing);
            await _db.SaveChangesAsync();

            return(NoContent());
        }