public void TestTotalCosts()
        {
            //Ensure that we are correctly calculating the total cost of the trip
            List <Booking>         bookings  = createBookings();
            TripBreakDownViewModel viewModel = new TripBreakDownViewModel(bookings);

            Assert.AreEqual(viewModel.TotalCost, (decimal)220.00);
        }
예제 #2
0
        // GET: Trips/BreakDown/5
        public ActionResult BreakDown(int id)
        {
            Trip trip = db.Trips.Where(t => t.TripId == id).Include(t => t.Bookings.Select(b => b.Expenses))
                        .SingleOrDefault();

            //This view model calculates the sub totals for each user, and how much each user owes.
            TripBreakDownViewModel breakDownModel = new TripBreakDownViewModel(trip.Bookings.ToList());

            return(View(breakDownModel));
        }