public async Task <ActionResult <CountryDto> > GetCountryById(
            int id,
            [FromQuery] bool includeCities             = false,
            [FromQuery] bool includeTravelRestrictions = false)
        {
            try
            {
                var result = await _countryRepo.GetCountryById
                             (
                    id,
                    includeCities,
                    includeTravelRestrictions
                             );

                if (result == null)
                {
                    return(NotFound($"Couldn't find any cities with ID: {id}"));
                }

                var mappedResult = _mapper.Map <CountryDto>(result);
                return(Ok(mappedResult));
            }
            catch (Exception e)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Database Failure: {e.Message}"));
            }
        }
Пример #2
0
        public CountryModel GetCountryById(Guid CountryId)
        {
            var model = _ICountryRepo.GetCountryById(CountryId);

            return(model);
        }