示例#1
0
        /// <summary>
        /// Pat Banks
        /// Created: 2015/03/19
        ///
        /// Takes data from the presentation layer and determines the results of attempting to add a booking
        /// </summary>
        /// <param name="bookingToAdd">Booking information from presentation Layer form</param>
        /// <returns>Results of adding the booking</returns>
        public ResultsEdit AddBookingResult(Booking bookingToAdd)
        {
            if (bookingToAdd.Quantity == 0)
            {
                return(ResultsEdit.QuantityZero);
            }
            try
            {
                //calls method to add a booking and update itemListing Table with current number of guests
                int result = BookingAccessor.AddBooking(bookingToAdd);

                if (result == 2)
                {
                    //update cache
                    RefreshItemListingDetailsListCacheData();

                    return(ResultsEdit.Success);
                }
                return(ResultsEdit.DatabaseError);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
        public void TestAddBookingAccess()
        {
            //Added to database and checked to see if an int row is returned, then compared to expected result
            int result   = BookingAccessor.AddBooking(booking);
            int expected = 2;

            Assert.AreEqual(expected, result);
        }
示例#3
0
 public void AddBooking()
 {
     int result = BookingAccessor.AddBooking(booking);
 }