Ejemplo n.º 1
0
        // ---------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// <param name="guestDTO"></param>
        /// <returns></returns>
        public static Guest GuestFromDTO(DTOReserver guestDTO)
        {
            DTOHelpers.ValidateGuestDTO(guestDTO);

            Guest newGuest = new Guest(guestDTO.GuestName, guestDTO.GuestPhone, guestDTO.GuestEmail);

            return(newGuest);
        }
Ejemplo n.º 2
0
        // ---------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// <param name="reservationDTO"></param>
        /// <returns></returns>
        public static Reservation ReservationFromDTO(DTOReservation reservationDTO)
        {
            // TODO: validation!

            Reservation reservation = new Reservation();

            reservation.Id         = reservationDTO.Id;
            reservation.Arrival    = reservationDTO.Arrival;
            reservation.GuestCount = reservationDTO.GuestCount;
            reservation.Duration   = reservationDTO.Duration;
            reservation.Note       = reservationDTO.Note;
            reservation.PartyName  = reservationDTO.PartyName;

            foreach (DTOReservable tableDto in reservationDTO.Reservables)
            {
                reservation.ReservedList.Add(DTOHelpers.TableFromDTO(tableDto));
            }


            return(reservation);
        }