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));
        }
예제 #2
0
        public ActionResult CreateCustomer(CustomerViewModel customer)
        {
            var customerDataService = new CustomerDataService();

            customerDataService.CreateCustomer(customer);
            return(new JsonResult()
            {
                Data = customer,
                ContentType = "application/json"
            });
        }
예제 #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);
        }