public IActionResult AddNewCustomer([FromBody] CustomerCreateDto newCustomer) { if (newCustomer == null) { return(BadRequest()); } else { var newCustomerModel = _mapper.Map <InsuranceCustomer>(newCustomer); var calculatedPremium = ratingEngine.Rate(newCustomerModel); _logger.LogInformation($"RatingEngine returned unrounded premium of: {calculatedPremium}"); var roundedPremium = Math.Round(calculatedPremium, 2); newCustomerModel.Premium = roundedPremium; _logger.LogInformation($"Rounded premium is: {roundedPremium}"); _repo.AddCustomer(newCustomerModel); _repo.Save(); newCustomerModel.Premium = Math.Round(newCustomerModel.Premium, MidpointRounding.ToEven); var quoteReadDTO = _mapper.Map <CustomerQuoteReadDto>(newCustomerModel); return(CreatedAtRoute(nameof(GetCustomerById), new { id = newCustomerModel.Id }, quoteReadDTO)); } }