private void CopyCustomer(Customer source, SimpleEditableCustomer target) { target.Id = source.Id; if (EditMode) { target.FirstName = source.FirstName; target.LastName = source.LastName; target.Phone = source.Phone; target.Email = source.Email; } }
public async Task<Customer> UpdateCustomerAsync(Customer customer) { if (!_context.Customers.Local.Any(c => c.Id == customer.Id)) { _context.Customers.Attach(customer); } _context.Entry(customer).State = EntityState.Modified; await _context.SaveChangesAsync(); return customer; }
private void NavToEditCustomer(Customer customer) { _addEditViewModel.EditMode = true; _addEditViewModel.SetCustomer(customer); CurrentViewModel = _addEditViewModel; }
private void NavToAddCustomer(Customer customer) { _addEditViewModel.EditMode = false; _addEditViewModel.SetCustomer(customer); CurrentViewModel = _addEditViewModel; }
public void SetCustomer(Customer cust) { _editingCustomer = cust; Customer = new SimpleEditableCustomer(); CopyCustomer(cust, Customer); }
public async Task<Customer> AddCustomerAsync(Customer customer) { _context.Customers.Add(customer); await _context.SaveChangesAsync(); return customer; }
private void OnPlaceOrder(Customer customer) { PlaceOrderReqested(customer.Id); }
private void OnEditCustomer(Customer customer) { EditCustomerReqested(customer); }