public static BookingdataReadDto FromBooking(Booking inBooking)
        {
            BookingdataReadDto aBookingReadDto = null;

            if (inBooking != null)
            {
                aBookingReadDto = new BookingdataReadDto(inBooking.Price);
                aBookingReadDto.BookingOrder = $"{inBooking.Price}";
            }
            return(aBookingReadDto);
        }
コード例 #2
0
        public ActionResult <BookingdataReadDto> Get(int id)
        {
            ActionResult <BookingdataReadDto> foundReturn;

            Booking foundBooking = _bControl.GetById(id);

            BookingdataReadDto foundDt = ModelConversion.BookingdataReadDtoConvert.FromBooking(foundBooking);

            if (foundDt != null)
            {
                foundReturn = Ok(foundDt);
                // Statuscode 200
            }
            else
            {
                foundReturn = new StatusCodeResult(500);
                // Internal server error
            }
            // send response back to client
            return(foundReturn);
        }