// ------------------------ END DongMing Hu ------------------------- // GET: Bookings by customer (Customer Booking History) public ActionResult CustomerHistory() { if (HttpContext.Session.GetObject <CustomerProfileManager>("login") != null) { //var cust = HttpContext.Session.TryGetValue("login", ); var cust = HttpContext.Session.GetObject <Customers>("login"); // Change this to Id retrieved from sessions int id = cust.CustomerId; var bookings = BookingsManager.GetAllBookingsByCustomer(id) .Select(bk => new BookingsModel { BookingId = bk.BookingId, BookingDate = bk.BookingDate, BookingNo = bk.BookingNo, TravelerCount = bk.TravelerCount, CustomerId = bk.Customer.CustFirstName, TripTypeId = bk.TripType.Ttname, PackageId = bk.Package.PkgName, Price = Math.Round((decimal)(bk.Package.PkgBasePrice + bk.Package.PkgAgencyCommission), 0), //Total = TotalOwing(bk.Package.PkgBasePrice).ToString("c") }).ToList(); return(View(bookings)); } else { return(View("Login")); //return RedirectToAction("Login"); } }
// GET: Bookings by customer (Customer Booking History) // This has been moved to CustomersController public ActionResult CustomerHistory() { // Change this to Id retrieved from sessions int id = 143; var bookings = BookingsManager.GetAllBookingsByCustomer(id) .Select(bk => new BookingsModel { BookingId = bk.BookingId, BookingDate = bk.BookingDate, BookingNo = bk.BookingNo, TravelerCount = bk.TravelerCount, CustomerId = bk.Customer.CustFirstName, TripTypeId = bk.TripType.Ttname, PackageId = bk.Package.PkgName }).ToList(); return(View(bookings)); }