Exemplo n.º 1
0
		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;
			}
		}
Exemplo n.º 2
0
        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;

        }
Exemplo n.º 3
0
 private void NavToEditCustomer(Customer customer)
 {
     _addEditViewModel.EditMode = true;
     _addEditViewModel.SetCustomer(customer);
     CurrentViewModel = _addEditViewModel;
 }
Exemplo n.º 4
0
 private void NavToAddCustomer(Customer customer)
 {
     _addEditViewModel.EditMode = false;
     _addEditViewModel.SetCustomer(customer);
     CurrentViewModel = _addEditViewModel;
 }
Exemplo n.º 5
0
		public void SetCustomer(Customer cust)
		{
			_editingCustomer = cust;
			Customer = new SimpleEditableCustomer();
			CopyCustomer(cust, Customer);
		}
Exemplo n.º 6
0
 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);
 }