public async Task <IActionResult> CreateCustomer([FromBody] Sales.Customer value) { _db.Sales_Customer.Add(value); await _db.SaveChangesAsync(); return(Ok(value)); }
private void Customer_Click(object sender, RoutedEventArgs e) { { bool isWindowOpen = false; foreach (Window w in Application.Current.Windows) { if (w is Sales.Customer) { isWindowOpen = true; w.Activate(); } } if (!isWindowOpen) { Sales.Customer customer = new Sales.Customer(); customer.Show(); } } }
public async Task <IActionResult> EditCustomer(int customerID, [FromBody] Sales.Customer value) { var existing = await _db.Sales_Customer.FirstOrDefaultAsync(x => x.CustomerID == customerID); if (existing == null) { return(NotFound()); } existing.CustomerID = value.CustomerID; existing.PersonID = value.PersonID; existing.StoreID = value.StoreID; existing.TerritoryID = value.TerritoryID; existing.AccountNumber = value.AccountNumber; existing.rowguid = value.rowguid; existing.ModifiedDate = value.ModifiedDate; _db.Sales_Customer.Update(existing); await _db.SaveChangesAsync(); return(NoContent()); }