public async Task <IActionResult> CreateSalesPerson([FromBody] Sales.SalesPerson value) { _db.Sales_SalesPerson.Add(value); await _db.SaveChangesAsync(); return(Ok(value)); }
public async Task <IActionResult> EditSalesPerson(int businessEntityID, [FromBody] Sales.SalesPerson value) { var existing = await _db.Sales_SalesPerson.FirstOrDefaultAsync(x => x.BusinessEntityID == businessEntityID); if (existing == null) { return(NotFound()); } existing.BusinessEntityID = value.BusinessEntityID; existing.TerritoryID = value.TerritoryID; existing.SalesQuota = value.SalesQuota; existing.Bonus = value.Bonus; existing.CommissionPct = value.CommissionPct; existing.SalesYTD = value.SalesYTD; existing.SalesLastYear = value.SalesLastYear; existing.rowguid = value.rowguid; existing.ModifiedDate = value.ModifiedDate; _db.Sales_SalesPerson.Update(existing); await _db.SaveChangesAsync(); return(NoContent()); }