Пример #1
0
        public async Task <ActionResult> Create([FromBody] CustomerInformation updateCustomerInfo)
        {
            try
            {
                var internalCustomerInfo = _mapper.Map(updateCustomerInfo);
                var result = await _customerBusiness.CreateCustomer(internalCustomerInfo);

                var customerInformation = _mapper.Map(result);
                return(Ok(customerInformation));
            }
            catch (ValidationException ex)
            {
                return(BadRequest(ex.Message));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Something went wrong trying to create customer information.");
                return(StatusCode(500));
            }
        }
Пример #2
0
 public CustomerModel CreateCustomer([FromBody] CustomerModel model)
 {
     _customerBusiness.CreateCustomer(model);
     return(model);
 }