public async Task <IActionResult> CreateSalesOrderHeaderSalesReason([FromBody] Sales.SalesOrderHeaderSalesReason value) { _db.Sales_SalesOrderHeaderSalesReason.Add(value); await _db.SaveChangesAsync(); return(Ok(value)); }
public async Task <IActionResult> EditSalesOrderHeaderSalesReason(int salesOrderID, int salesReasonID, [FromBody] Sales.SalesOrderHeaderSalesReason value) { var existing = await _db.Sales_SalesOrderHeaderSalesReason.FirstOrDefaultAsync(x => x.SalesOrderID == salesOrderID && x.SalesReasonID == salesReasonID); if (existing == null) { return(NotFound()); } existing.SalesOrderID = value.SalesOrderID; existing.SalesReasonID = value.SalesReasonID; existing.ModifiedDate = value.ModifiedDate; _db.Sales_SalesOrderHeaderSalesReason.Update(existing); await _db.SaveChangesAsync(); return(NoContent()); }