public async Task <IActionResult> WebCheckIn(int bookingId = 0) { if (bookingId == 0) { var currUserId = _globalRepo.GetCurrentUserId().ToString(); } //save bookingId to session _globalRepo.SaveObjToSessionJSON <int>("tempBookingId", bookingId); var bookingvm = await _bookingRepo.GetBookingWGuestsById(bookingId); var booking = bookingvm.Booking; //only use if no value is intended to be changed //fill in flight details of the booking bookingvm.Booking.GoFlight = await _flightRepo.GetByFlightId(booking.GoFlightId); bookingvm.Booking.GoFlight.OriginLoc1 = await _countryRepo.GetLocById(booking.GoFlight.OriginLocID); bookingvm.Booking.GoFlight.DestLoc1 = await _countryRepo.GetLocById(booking.GoFlight.DestLocID); bookingvm.Booking.GoFlight.FlightSeatType = await _flightRepo.GetFlightSeatTypeById(booking.GoFlight.FlightSeatTypeID); //if there is return flight, fill in flight details of return flight to booking if (booking.ReturnFlightId > 0) { bookingvm.Booking.ReturnFlight = await _flightRepo.GetByFlightId(booking.ReturnFlightId); bookingvm.Booking.ReturnFlight.OriginLoc1 = await _countryRepo.GetLocById(booking.ReturnFlight.OriginLocID); bookingvm.Booking.ReturnFlight.DestLoc1 = await _countryRepo.GetLocById(booking.ReturnFlight.DestLocID); bookingvm.Booking.ReturnFlight.FlightSeatType = await _flightRepo.GetFlightSeatTypeById(booking.ReturnFlight.FlightSeatTypeID); } //to retrieve flight seats var seatsTakenGoFlight = await _bookingRepo.GetSeatsTakenByFlightId(booking.GoFlightId, true); var seatsTakenReturnFlight = await _bookingRepo.GetSeatsTakenByFlightId(booking.ReturnFlightId, false); //create vm to pass to view var vm = new SelectSeatViewVM { Booking = bookingvm.Booking, BookingNonMembersList = bookingvm.BookingNonMembers, SeatsTakenGoFlight = seatsTakenGoFlight.ToList(), SeatsTakenReturnFlight = seatsTakenReturnFlight.ToList() }; return(View("SelectSeatView", vm)); }