public async Task <IActionResult> EditSpecialOffer(int specialOfferID, [FromBody] Sales.SpecialOffer value) { var existing = await _db.Sales_SpecialOffer.FirstOrDefaultAsync(x => x.SpecialOfferID == specialOfferID); if (existing == null) { return(NotFound()); } existing.SpecialOfferID = value.SpecialOfferID; existing.Description = value.Description; existing.DiscountPct = value.DiscountPct; existing.Type = value.Type; existing.Category = value.Category; existing.StartDate = value.StartDate; existing.EndDate = value.EndDate; existing.MinQty = value.MinQty; existing.MaxQty = value.MaxQty; existing.rowguid = value.rowguid; existing.ModifiedDate = value.ModifiedDate; _db.Sales_SpecialOffer.Update(existing); await _db.SaveChangesAsync(); return(NoContent()); }
public async Task <IActionResult> CreateSpecialOffer([FromBody] Sales.SpecialOffer value) { _db.Sales_SpecialOffer.Add(value); await _db.SaveChangesAsync(); return(Ok(value)); }