コード例 #1
0
        public IActionResult GetCountry(int countryId)
        {
            if (!_countryRepository.CountryExist(countryId))
            {
                return(NotFound());
            }
            var country = _countryRepository.GetCountry(countryId);

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var countryDto = new CountryDto
            {
                Id   = country.Id,
                Name = country.Name
            };

            return(Ok(countryDto));
        }