public TravellerUser GetUserByApiKey(String apiKey)
        {
            TravellerUser usr = TravellerUsers.ToList().Find(usr => PasswordHasher.CheckHash(usr.ApiKey, apiKey));

            if (usr == null)
            {
                throw InvalidOperationException("User does not exist");
            }
            return(usr);
        }
        public TravellerUser GetUser(String username)
        {
            TravellerUser usr = TravellerUsers.ToList().Find(usr => usr.UserName == username);

            if (usr == null)
            {
                throw InvalidOperationException("User does not exist");
            }
            return(usr);
        }
        public void CreateTrip(int forUserId, String tripName)
        {
            Trip trip = new()
            {
                TripName                = tripName,
                HotelReservations       = new List <HotelReservation>(),
                CarRentalReservations   = new List <CarRentalReservation>(),
                PlaneTicketReservations = new List <PlaneTicketReservation>(),
            };
            TravellerUser usr = TravellerUsers.ToList().Find(usr => usr.Id == forUserId);

            usr.Trips.Add(trip);
            this.SaveChanges();
        }
        public void CreateTravellerUser(String apiKey, String loginHash, String username)
        {
            if (TravellerUsers.ToList().Find(usr => usr.UserName == username) != null)
            {
                throw InvalidOperationException("UserAlreadyExists");
            }
            TravellerUser usr = new()
            {
                LoginHash = loginHash,
                ApiKey    = apiKey,
                UserName  = username,
                Trips     = new List <Trip>()
            };

            TravellerUsers.Add(usr);
            this.SaveChanges();
        }