public void ModifyCustomer(Customer old, Modification[] modifications) { var record = new Record() { Message = $"Modification customer {old.FullString()}: " + string.Join(", ", modifications.Select(m => $"property {m.Type} => from '{m.OldValue}' to '{m.NewValue}', ")), }; _context.Records.Add(record); CustomersChanged?.Invoke(); }
public void AddCustomer(Customer customer) { var record = new Record() { Message = $"Added new customer: {customer.FullString()}" }; _context.Customers.Add(customer); _customers.Add(customer); _context.Records.Add(record); CustomersChanged?.Invoke(); }
public async void AddCustomerAsync(Customer customer) { await Task.Factory.StartNew(() => { var record = new Record() { Message = $"Added new customer: {customer.FullString()}" }; _context.Customers.Add(customer); _context.Records.Add(record); _context.SaveChanges(); }); _customers.Add(customer); CustomersChanged?.Invoke(); }
public async void ModifyCustomerAsync(Customer old, Modification[] modifications) { await Task.Factory.StartNew(() => { var record = new Record() { Message = $"Modification customer {old.FullString()}: " + string.Join(", ", modifications.Select(m => $"property {m.Type} => from '{m.OldValue}' to '{m.NewValue}', ")), }; _context.Records.Add(record); _context.SaveChanges(); }); CustomersChanged?.Invoke(); }