Esempio n. 1
0
        public IActionResult GetSingle(int id)
        {
            HouseEntity houseEntity = _houseRepository.GetSingle(id);

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

            return(Ok(_houseMapper.MapToDto(houseEntity)));
        }
        public IActionResult GetSingle(int id)
        {
            HouseEntity houseEntityFromRepo = _houseRepository.GetSingle(id);

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

            return(Ok(Mapper.Map <HouseDto>(houseEntityFromRepo)));
        }
Esempio n. 3
0
        public IActionResult GetSingle(int id)
        {
            try
            {
                HouseEntity houseEntity = _houseRepository.GetSingle(id);

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

                return(Ok(_houseMapper.MapToDto(houseEntity)));
            }
            catch (Exception exception)
            {
                //logg exception or do anything with it
                return(StatusCode((int)HttpStatusCode.InternalServerError));
            }
        }