Ejemplo n.º 1
0
        public async Task <DataResult <CustomerModel> > CreateCustomer(CustomerCreationModel customerCreationModel)
        {
            Customer customer = _customerMapper.MapBackToEntity(customerCreationModel);

            customer.CreatedDate = DateTime.UtcNow;

            Customer addedCustomer = await _customerRepository.AddAsync(customer);

            await _customerRepository.SaveAsync();

            CustomerModel customerModel = _customerMapper.MapToModel(addedCustomer);

            return(new DataResult <CustomerModel>
            {
                Data = customerModel,
                ResponseMessageType = ResponseMessageType.Success
            });
        }