Esempio n. 1
0
        public IActionResult GetNationalPark(int nationalParkId)
        {
            var nationalPark = _nationalParkRepository.GetById(nationalParkId);

            if (nationalPark == null)
            {
                return(NotFound());
            }

            return(Ok(_mapper.Map <NationalParkDTO>(nationalPark)));
        }
        public async Task <IActionResult> Upsert(int?id)
        {
            var nationalPark = new NationalPark();

            if (!id.HasValue)
            {
                return(View(nationalPark));
            }

            nationalPark = await _nationalParkRepository.GetById(AppConstants.NationalParkApiPath, id.Value);

            if (nationalPark == null)
            {
                return(NotFound());
            }

            return(View(nationalPark));
        }