public async Task <ActionResult> Details(Guid id, string errorMessage = null)
        {
            var booking = _context.Bookings
                          .Include(b => b.BookedPilots).ThenInclude(bp => bp.Pilot)
                          .Include(b => b.BookingEvents).ThenInclude(be => be.User)
                          .Include(b => b.AssignedPilot)
                          .Include(b => b.AdditionalBookings).ThenInclude(b => b.AssignedPilot)
                          .Include(b => b.PrimaryBooking).ThenInclude(b => b.AssignedPilot)
                          .Include(b => b.PrimaryBooking).ThenInclude(b => b.AdditionalBookings)
                          .Include(b => b.BookingLocation)
                          .FirstOrDefault(b => b.Id == id);

            if (booking == null)
            {
                return(NotFound("Booking not found"));
            }

            var vm = new BookingDetailsViewModel
            {
                ErrorMessage    = errorMessage,
                Booking         = booking,
                Editable        = User.IsAdmin() || booking.AssignedPilot?.Id == _userManager.GetUserId(User),
                AvailablePilots = await _bookingService.FindAvailablePilotsAsync(booking.BookingDate, booking.BookingLocation, true),
            };

            ViewBag.ErrorMessage = errorMessage;
            return(View(vm));
        }
        // GET: /Manage/BookingDetails
        /// <summary>
        /// Serve booking details page
        /// </summary>
        /// @author - Harry
        public ActionResult BookingDetails(string bookingNo)
        {
            // make sure we have a booking number
            if (bookingNo == null)
            {
                return(RedirectToAction("Index"));
            }

            // put booking number in bag
            ViewBag.BookingNo = bookingNo;
            // get customer
            Customer curr = GetCurrentCustomer();

            List <BookingDetail> details = TravelExpertsData.GetBookingDetails(curr, bookingNo);
            List <Fee>           fees    = new List <Fee>();

            // get each booking details fee
            foreach (BookingDetail detail in details)
            {
                fees.Add(TravelExpertsData.GetFee(curr, detail.BookingDetailId));
            }

            // set up model
            var model = new BookingDetailsViewModel
            {
                Details = details,
                Fees    = fees
            };

            return(View(model));
        }
        public IActionResult Bookingdetails(Guid Id)
        {
            BookingDetailsViewModel bookingDetailsViewModel = new BookingDetailsViewModel();

            bookingDetailsViewModel.id = Id;
            return(View(bookingDetailsViewModel));
        }
        public ActionResult UpdateStatus(BookingDetailsViewModel booking)
        {
            var order = _context.bookingModels.Include(c => c.OrderStatusId).Single(c => c.Id == booking.bookingModel.Id);

            order.OrderStatusId = _context.orderStatusModels.Single(c => c.id == booking.bookingModel.OrderStatusId.id);

            _context.SaveChanges();

            return(RedirectToAction("Bookings"));
        }
        public IActionResult Bookingdetails(BookingDetailsViewModel model)
        {
            Booking booking = context.Bookings.Find(model.id);

            booking.First_Name    = model.First_Name;
            booking.Last_Name     = model.Last_Name;
            booking.PhoneNumber   = model.PhoneNumber;
            booking.Email         = model.Email;
            booking.Gender        = model.Gender;
            booking.Age           = model.Age;
            booking.Prefered_Seat = model.Prefered_Seat;

            context.SaveChanges();
            HttpContext.Session.SetString("id", model.id.ToString());


            return(RedirectToAction("summary/" + booking.Id.ToString()));
        }
        public static BookingDetailsViewModel ToDetailsViewModel(this Booking source)
        {
            var destination = new BookingDetailsViewModel();

            destination.Id = source.Id;

            destination.CreatedBy              = source.CreatedBy != null ? source.CreatedBy.UserName : "******";
            destination.ServiceName            = source.Service.Name;
            destination.RequestDate            = source.RequestDate;
            destination.PickupRequired         = source.PickupRequired ? "Yes" : "No";
            destination.PickupAddress          = source.PickupAddress;
            destination.PickupContactNumber    = source.PickupContactNumber;
            destination.ConsigneeName          = source.ConsigneeName;
            destination.ConsigneeContactNumber = source.ConsigneeContactNumber;
            destination.ConsigneeAddress       = source.ConsigneeAddress;
            destination.CreatedAt              = source.CreatedAt;

            if (source.Customer != null)
            {
                destination.Customer = source.Customer.ToDetailsViewModel();
            }

            if (source.Origin != null)
            {
                destination.Origin = source.Origin.ToViewModel();
            }

            if (source.Destination != null)
            {
                destination.Destination = source.Destination.ToViewModel();
            }

            if (source.Invoice != null)
            {
                destination.Invoice = source.Invoice.ToDetailsViewModel();
            }
            if (source.Package != null)
            {
                destination.Package = source.Package.ToDetailsViewModel();
            }

            return(destination);
        }
        public ActionResult Admin()
        {
            var bookings = _bookingService.GetAllBookings().ToList();
            var list     = new BookingsListViewModel();

            foreach (var b in bookings)
            {
                var bd = new BookingDetailsViewModel
                {
                    ClientEmail = b.ClientEmail,
                    ClientName  = b.ClientName,
                    DateCreated = b.DateCreated,
                    Id          = b.Id,
                    MovieName   = b.PlayBill.Movie.Name,
                    Hall        = b.PlayBill.Hall.Name,
                    SeatSummary = $"Row: {b.Seat.RowNum}, Seat: {b.Seat.SeatNum}"
                };
                list.Bookings.Add(bd);
            }
            return(View("Admin", list));
        }
        public ActionResult BokkingDetails(int id)
        {
            BookingDetailsViewModel booking = new BookingDetailsViewModel();

            booking.bookingModel = _context.bookingModels.Include(c => c.OrderStatusId).Include(d => d.CarModel).Single(c => c.Id == id);
            var statusList             = _context.orderStatusModels.ToList();
            List <SelectListItem> test = new List <SelectListItem>();

            foreach (var status in statusList)
            {
                test.Add(new SelectListItem
                {
                    Text  = status.name,
                    Value = status.id.ToString()
                });
            }

            booking.orderStatus = test;

            //var booking = _context.bookingModels.Include(c => c.OrderStatusId).Single(c => c.Id == id);

            return(View(booking));
        }
Exemple #9
0
 private void BookingDetail_btn_Click(object sender, RoutedEventArgs e)
 {
     DataContext = new BookingDetailsViewModel();
 }