public IActionResult GetFlatById(string id) { var requestResult = _flatService.GetFlatById(id); if (!requestResult.Status) { if (requestResult.ServerError) { return(StatusCode(500)); } if (requestResult.Errors.Contains("Flat not found")) { return(NotFound("Flat not found")); } return(BadRequest(new FailedFlatResponse { Errors = requestResult.Errors, Status = requestResult.Status })); } return(Ok(new SuccessFlatByIdResponse { Flat = requestResult.Flat, Status = requestResult.Status })); }