public void Execute(object parameter)
        {
            CustomerDetailVm viewModel      = new CustomerDetailVm(new Customer());
            CustomerDetail   customerDetail = new CustomerDetail(viewModel);

            customerDetail.Show();
        }
示例#2
0
        public void Execute(object parameter)
        {
            var mainViewModel     = (MainViewModel)Application.Current.Properties["mainViewModel"];
            var customerConverter = new CustomerConverter(mainViewModel.SelectedItemRow);

            var customer = customerConverter.Convert();

            CustomerDetailVm viewModel      = new CustomerDetailVm(customer);
            CustomerDetail   customerDetail = new CustomerDetail(viewModel);

            customerDetail.Show();
        }
        public async Task <ApiResponse <CustomerDetailVm> > CreateCustomer(CustomerDetailVm customerDetailViewModel)
        {
            try
            {
                ApiResponse <CustomerDetailVm> apiResponse           = new ApiResponse <CustomerDetailVm>();
                CreateCustomerCommand          createCustomerCommand = _mapper.Map <CreateCustomerCommand>(customerDetailViewModel);
                var createCustomerCommandResponse = await _client.AddCustomerAsync(createCustomerCommand);

                if (createCustomerCommandResponse.Success)
                {
                    apiResponse.Data    = _mapper.Map <CustomerDetailVm>(createCustomerCommandResponse.Customer);
                    apiResponse.Success = true;
                }

                return(apiResponse);
            }
            catch (ApiException ex)
            {
                return(ConvertApiExceptions <CustomerDetailVm>(ex));
            }
        }
 public CustomerDetail(CustomerDetailVm viewModel)
 {
     InitializeComponent();
     this.DataContext = viewModel;
 }