public async Task <IActionResult> CreateVendor([FromBody] Purchasing.Vendor value) { _db.Purchasing_Vendor.Add(value); await _db.SaveChangesAsync(); return(Ok(value)); }
public async Task <IActionResult> EditVendor(int businessEntityID, [FromBody] Purchasing.Vendor value) { var existing = await _db.Purchasing_Vendor.FirstOrDefaultAsync(x => x.BusinessEntityID == businessEntityID); if (existing == null) { return(NotFound()); } existing.BusinessEntityID = value.BusinessEntityID; existing.AccountNumber = value.AccountNumber; existing.Name = value.Name; existing.CreditRating = value.CreditRating; existing.PreferredVendorStatus = value.PreferredVendorStatus; existing.ActiveFlag = value.ActiveFlag; existing.PurchasingWebServiceURL = value.PurchasingWebServiceURL; existing.ModifiedDate = value.ModifiedDate; _db.Purchasing_Vendor.Update(existing); await _db.SaveChangesAsync(); return(NoContent()); }