Exemplo n.º 1
0
        public Dictionary <int, Reservation> AddNewReservation(int siteSelection, string reservationName, DateTime[] reservationRange)
        {
            ReservationSqlDAL             reservationSql = new ReservationSqlDAL();
            Dictionary <int, Reservation> newReservation = new Dictionary <int, Reservation>();

            newReservation = reservationSql.AddNewReservation(siteSelection, reservationName, reservationRange);

            return(newReservation);
        }
        public void AddNewReservation(Reservation reservation)
        {
            IReservationDAL reservationdal = new ReservationSqlDAL(DatabaseConnectionString.DatabaseString);

            (bool worked, int reservationId) = reservationdal.AddNewReservation(reservation);
            if (worked == true)
            {
                Console.WriteLine($"The reservation has been made and the confirmation id is {reservationId}");
            }
        }
Exemplo n.º 3
0
        public void AddReservation_AddsReservation()
        {
            // Arrange
            ReservationSqlDAL RSDal       = new ReservationSqlDAL(ConnectionString);
            Reservation       reservation = new Reservation();

            reservation.SiteId   = 1;
            reservation.Name     = "Test";
            reservation.FromDate = Convert.ToDateTime("10/22/2018");
            reservation.ToDate   = Convert.ToDateTime("10/27/2018");


            // Act
            (bool added, int id) = RSDal.AddNewReservation(reservation);

            // Assert
            Assert.IsTrue(added);
            Assert.AreEqual(1, id);
        }