Beispiel #1
0
        public List <BookingRoomdto> GetBookingRoom()
        {
            List <BookingRoomdto> personlistdto = new List <BookingRoomdto>();

            foreach (var item in db.BookingRoom)
            {
                BookingRoomdto dto = new BookingRoomdto();
                dto.ID       = item.ID;
                dto.ToDate   = item.ToDate;
                dto.FromDate = item.FromDate;

                if (item.UserID != null)
                {
                    dto.UserID = item.UserID;
                }
                personlistdto.Add(dto);
            }
            return(personlistdto);
        }
Beispiel #2
0
        public IHttpActionResult GetBookingRoom(int id)
        {
            BookingRoom bookingRoom = db.BookingRoom.Find(id);

            if (bookingRoom == null)
            {
                return(NotFound());
            }
            BookingRoomdto dto = new BookingRoomdto();

            dto.ID       = bookingRoom.ID;
            dto.ToDate   = bookingRoom.ToDate;
            dto.FromDate = bookingRoom.FromDate;

            if (bookingRoom.UserID != null)
            {
                dto.UserID = bookingRoom.UserID;
            }
            return(Ok(dto));
        }