public async Task <IActionResult> CreateProductVendor([FromBody] Purchasing.ProductVendor value) { _db.Purchasing_ProductVendor.Add(value); await _db.SaveChangesAsync(); return(Ok(value)); }
public async Task <IActionResult> EditProductVendor(int businessEntityID, int productID, [FromBody] Purchasing.ProductVendor value) { var existing = await _db.Purchasing_ProductVendor.FirstOrDefaultAsync(x => x.BusinessEntityID == businessEntityID && x.ProductID == productID); if (existing == null) { return(NotFound()); } existing.ProductID = value.ProductID; existing.BusinessEntityID = value.BusinessEntityID; existing.AverageLeadTime = value.AverageLeadTime; existing.StandardPrice = value.StandardPrice; existing.LastReceiptCost = value.LastReceiptCost; existing.LastReceiptDate = value.LastReceiptDate; existing.MinOrderQty = value.MinOrderQty; existing.MaxOrderQty = value.MaxOrderQty; existing.OnOrderQty = value.OnOrderQty; existing.UnitMeasureCode = value.UnitMeasureCode; existing.ModifiedDate = value.ModifiedDate; _db.Purchasing_ProductVendor.Update(existing); await _db.SaveChangesAsync(); return(NoContent()); }