public async Task <object> CreateReservation(Reservation reservation, string initiatorEmail)
        {
            AirlineReservation airlineReservation;
            CarReservation     carReservation;
            User user;

            if (reservation.AirlineReservation != null)
            {
                user = (await _userManager.FindByEmailAsync(reservation.AirlineReservation.PassengerEmail));    //user koji sedi                                                                                                                       //ako je to taj user treba mu postaviti status rezervacije na CONFIRMED da bi bila vidljiva na profilu
                var role = await _userManager.GetRolesAsync(user);
            }
            else
            {
                user = await _userManager.FindByEmailAsync(reservation.CarReservation.UserEmail);
            }


            try
            {
                if (reservation.AirlineReservation == null)
                {
                    airlineReservation = null;
                }
                else
                {
                    //red i vrsta => rowNo seatNo
                    var flight = (await _context.Flight.ToListAsync()).FirstOrDefault(f => f.Id == reservation.AirlineReservation.Flight.Id);
                    var seat   = flight.SeatConfiguration.Seats[reservation.AirlineReservation.RowNumber].Seats[reservation.AirlineReservation.SeatNumber];


                    seat.PassengerEmail = user.Email;
                    seat.SeatStatus     = "TAKEN";

                    await _context.SaveChangesAsync();

                    airlineReservation = new AirlineReservation()
                    {
                        Flight               = flight,
                        PassengerEmail       = user.Email,
                        DeadlineForCanceling = reservation.AirlineReservation.DeadlineForCanceling,
                        RowNumber            = reservation.AirlineReservation.RowNumber,
                        SeatNumber           = reservation.AirlineReservation.SeatNumber,
                        ConfirmDate          = ""
                    };

                    await _context.AirlineReservation.AddAsync(airlineReservation);

                    await _context.SaveChangesAsync();
                }


                if (reservation.CarReservation == null)
                {
                    carReservation = null;
                }
                else
                {
                    var carResModel = new CarReservationModel()
                    {
                        Car       = reservation.CarReservation.Car,
                        CarId     = reservation.CarReservation.CarId,
                        EndDate   = reservation.CarReservation.EndDate,
                        StartDate = reservation.CarReservation.StartDate,
                        FullPrice = reservation.CarReservation.FullPrice,
                        UserEmail = reservation.CarReservation.UserEmail
                    };

                    carReservation = await _carService.MakeReservation(carResModel);
                }


                var fullReservation = new Reservation()
                {
                    AirlineReservation = airlineReservation,
                    CarReservation     = carReservation,
                    Status             = (user.Email == initiatorEmail) ? "CONFIRMED" : reservation.Status, //da li je napustena tj otkazana (UNCONFIRMED polje iz Ang)
                    IsFinished         = reservation.IsFinished                                             //na osnovu ovoga znamo da li je zavrsena
                };

                await _context.Reservation.AddAsync(fullReservation);

                await _context.SaveChangesAsync();

                return(fullReservation);
            }
            catch (DbException dex)
            {
                Console.WriteLine(dex);
                return(HttpStatusCode.InternalServerError);
            }
        }
 public ActionResult BuscarVuelos(AirlineReservation.Models.Reservacion reservacion, int pagina)
 {
     ViewBag.cliente = reservacion.PasajeroID;
     ViewBag.agente = reservacion.AgenciaID;
     return View(reservacion.VuelosPosibles(pagina, reservacion.AeropuertoOrigenID, reservacion.AeropuertoDestinoID));
 }