public async Task <ActionResult <Customer> > CreateCustomerAsync(CustomerCreateDto customerCreateDto) { var customerModel = _mapper.Map <Customer>(customerCreateDto); await _repository.CreateAsync(customerModel); await _repository.SaveChangesAsync(); // here we query the customer that we just created in order to load its navigation property customerModel = await _repository.GetByIdAsync(customerModel.Id); var customerReadDto = _mapper.Map <CustomerReadDto>(customerModel); return(CreatedAtRoute(nameof(GetCustomerAsync), new { customerReadDto.Id }, customerReadDto)); }