public IActionResult CreateCustomer([FromBody] CreateCustomerRequest request)
        {
            CustomerDataService    customerService        = new CustomerDataService(customerRepository, domainEventPublisher);
            Customer               customer               = customerService.CreateCustomer(request.Name, request.CreditLimit);
            CreateCustomerResponse createCustomerResponse = new CreateCustomerResponse(customer.Id);

            return(Ok(createCustomerResponse));
        }
Esempio n. 2
0
        public ActionResult CreateCustomer(CustomerViewModel customer)
        {
            var customerDataService = new CustomerDataService();

            customerDataService.CreateCustomer(customer);
            return(new JsonResult()
            {
                Data = customer,
                ContentType = "application/json"
            });
        }
Esempio n. 3
0
        protected async Task HandleValidSubmit()
        {
            CustomerDetailVm.CustomerTypeId = Guid.Parse(SelectedCustomerTypeId);

            ApiResponse <CustomerDetailVm> response;

            if (SelectedCustomerId == Guid.Empty)
            {
                response = await CustomerDataService.CreateCustomer(CustomerDetailVm);
            }
            else
            {
                response = await CustomerDataService.UpdateCustomer(CustomerDetailVm);
            }
            HandleResponse(response);
        }