Ejemplo n.º 1
0
        /// <summary>
        /// Display reservation details (Hotle, room, reservation info, ...) when the user is authorized
        /// </summary>
        public ActionResult Details(int id)
        {
            //Check if session exist
            if (Session["IsAuthorized"] != null)
            {
                bool isAuthorized = Convert.ToBoolean(Session["IsAuthorized"]);

                //check session status, if true get data and display it
                if (isAuthorized)
                {
                    Reservation reservation = ReservationManager.GetReservation(id);

                    ReservationValidateVM reservationValidate = new ReservationValidateVM();
                    reservationValidate.Arrival    = reservation.Arrival;
                    reservationValidate.Departure  = reservation.Departure;
                    reservationValidate.TotalNight = ReservationManager.GetNumberOfNight(reservation.Arrival, reservation.Departure);
                    reservationValidate.FirstName  = reservation.Client.Firstname;
                    reservationValidate.LastName   = reservation.Client.Lastname;
                    reservationValidate.Rooms      = reservation.Rooms;
                    reservationValidate.TotalPrice = ReservationManager.CalculatePrice(reservation.Rooms, reservation.Arrival, reservation.Departure);
                    reservationValidate.RoomNumber = reservation.Rooms.Count();

                    ViewBag.ReservationValidate = reservationValidate;

                    return(View());
                }
            }

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public ReservationDto GetReservation(int id)
        {
            WriteActualMethod();
            ReservationManager manager = new ReservationManager();

            return(DtoConverter.ConvertToDto(manager.GetReservation(id)));
        }