Exemplo n.º 1
0
        public static async Task <List <MovieFirebase> > GetMoviesAsync(String uEmail)
        {
            moviesProjectContext context = new moviesProjectContext();

            try
            {
                List <MovieFirebase> MovieList = new List <MovieFirebase>();
                //query = "SELECT movieId FROM watchlist WHERE userEmail='" + uEmail + "'";

                var movies = context.Watchlists.AsQueryable().Where(x => x.UserEmail.Equals(uEmail)).ToList();

                foreach (Watchlist item in movies)
                {
                    MovieFirebase movie = new MovieFirebase();
                    movie = await MovieMethods.GetMovie(item.MovieId);

                    MovieList.Add(movie);
                }

                return(MovieList);
            }
            catch (Exception e)
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        async public static Task <MovieFirebase> GetMovie(int id)
        {
            Firebase    fb = new Firebase();
            FirestoreDb db = fb.db;

            Query         docQ = db.Collection("movies").WhereEqualTo("id", id);
            QuerySnapshot snap = await docQ.GetSnapshotAsync();

            MovieFirebase movie = new MovieFirebase();

            foreach (DocumentSnapshot docsnap in snap)
            {
                movie = docsnap.ConvertTo <MovieFirebase>();
            }


            return(movie);
        }
Exemplo n.º 3
0
        async public static Task <List <MovieFirebase> > GetNowPlaying(int page)
        {
            Firebase    fb = new Firebase();
            FirestoreDb db = fb.db;

            Query         docQ = db.Collection("movies").WhereGreaterThan("release_date", "2021-01-01").WhereLessThan("release_date", "2021-13-04").OrderByDescending("release_date").Limit(20).Offset(page * 20);
            QuerySnapshot snap = await docQ.GetSnapshotAsync();

            MovieFirebase movie = new MovieFirebase();

            List <MovieFirebase> mlist = new List <MovieFirebase>();

            foreach (DocumentSnapshot docsnap in snap)
            {
                movie = docsnap.ConvertTo <MovieFirebase>();
                mlist.Add(movie);
            }

            return(mlist);
        }
Exemplo n.º 4
0
        async public static Task <List <MovieFirebase> > GetTopRated(int page)
        {
            Firebase    fb = new Firebase();
            FirestoreDb db = fb.db;

            Query         docQ = db.Collection("movies").OrderByDescending("vote_count").OrderByDescending("vote_average").Limit(20).Offset(page * 20);
            QuerySnapshot snap = await docQ.GetSnapshotAsync();

            MovieFirebase movie = new MovieFirebase();

            List <MovieFirebase> mlist = new List <MovieFirebase>();

            foreach (DocumentSnapshot docsnap in snap)
            {
                movie = docsnap.ConvertTo <MovieFirebase>();
                mlist.Add(movie);
            }

            return(mlist);
        }
Exemplo n.º 5
0
        async public static Task <List <MovieFirebase> > SearchLangMovie(string lang, int page)
        {
            Firebase    fb = new Firebase();
            FirestoreDb db = fb.db;

            Query         docQ = db.Collection("movies").WhereEqualTo("original_language", lang).OrderByDescending("popularity").Limit(20).Offset(page * 20);
            QuerySnapshot snap = await docQ.GetSnapshotAsync();

            MovieFirebase movie = new MovieFirebase();

            List <MovieFirebase> mlist = new List <MovieFirebase>();

            foreach (DocumentSnapshot docsnap in snap)
            {
                movie = docsnap.ConvertTo <MovieFirebase>();
                mlist.Add(movie);
            }

            return(mlist);
        }
Exemplo n.º 6
0
        async public static Task <List <MovieFirebase> > SearchGerneMovie(int genre, int page)
        {
            Firebase    fb = new Firebase();
            FirestoreDb db = fb.db;

            Query         docQ = db.Collection("movies").WhereArrayContains("genre_ids", genre).OrderByDescending("popularity").Limit(20).Offset(page * 20);
            QuerySnapshot snap = await docQ.GetSnapshotAsync();

            MovieFirebase movie = new MovieFirebase();

            List <MovieFirebase> mlist = new List <MovieFirebase>();

            foreach (DocumentSnapshot docsnap in snap)
            {
                movie = docsnap.ConvertTo <MovieFirebase>();
                mlist.Add(movie);
            }

            return(mlist);
        }