コード例 #1
0
ファイル: HouseController.cs プロジェクト: ice19942335/BBIT
        public IActionResult GetHouseFlats(string id)
        {
            var flatsInHouseResult = _houseService.GetHouseFlats(id);

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

                if (flatsInHouseResult.ItemNotFound)
                {
                    return(NotFound("House not found."));
                }

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

            return(Ok(new SuccessHouseFlatsResponse
            {
                Status = flatsInHouseResult.Status,
                Flats = flatsInHouseResult.Flats
            }));
        }