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)); }
public ActionResult CreateCustomer(CustomerViewModel customer) { var customerDataService = new CustomerDataService(); customerDataService.CreateCustomer(customer); return(new JsonResult() { Data = customer, ContentType = "application/json" }); }
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); }