예제 #1
0
        public IActionResult GetHouseById(string id)
        {
            var requestResult = _houseService.GetHouseById(id);

            if (!requestResult.Status)
            {
                if (requestResult.ServerError)
                {
                    return(StatusCode(500));
                }

                return(BadRequest(new FailedHouseResponse
                {
                    Errors = requestResult.Errors,
                    Status = requestResult.Status
                }));
            }

            if (requestResult.House is null)
            {
                return(NotFound("Item not found."));
            }

            return(Ok(new SuccessHouseByIdResponse
            {
                House = requestResult.House,
                Status = requestResult.Status
            }));
        }
예제 #2
0
        public ActionResult <House> GetHouseById(int houseId)
        {
            var house = _houseService.GetHouseById(houseId);

            if (house == null)
            {
                return(NotFound());
            }
            return(Ok(house));
        }