public async Task <ActionResult <CountryDto> > PostCountry(CountryDto countryDto) { try { var mappedEntity = _mapper.Map <CountryModel>(countryDto); _countryRepo.Add(mappedEntity); if (await _countryRepo.Save()) { return(Created($"/api/v1.0/countries/{mappedEntity.CountryId}", _mapper.Map <CountryModel>(mappedEntity))); } } catch (Exception e) { return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Database Failure: {e.Message}")); } return(BadRequest()); }