public PartialViewResult HomeList_byLatest2(string Page)
        {
            AgfMembershipProvider membership  = new AgfMembershipProvider();
            MovieAccess           movieAccess = new MovieAccess();
            bool check;

            if (check = System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
            {
                var  user   = User.Identity.Name.ToString();
                Guid?userId = membership.GetUserIdByEmail(user);
                var  res    = movieAccess.GetHomeList(userId).OrderBy(s => s.DateAdded);
                var  count  = Math.Ceiling(res.Count() / 6.0);
                ViewBag.Pages = count;

                int page = int.Parse(Page == null ? "1" : Page);
                ViewBag.Page = page;


                res = res.Skip((page - 1) * 6).ToList().Take(6).OrderBy(s => s.DateAdded);

                return(PartialView("_GetCardss", res));
            }

            else
            {
                var res = movieAccess.GetHomeList().OrderBy(s => s.DateAdded);
                return(PartialView("_GetCardss", res));
            }
        }
        public void CanReturnListOfFilmsFilteredByMultipleGenres()
        {
            MovieAccess sut = CreateSystemUnderTest();

            IReadOnlyCollection <Movie> movies = sut.GetMovies(null, null, Genre.Action | Genre.Drama);

            Assert.Single(movies);
        }
        public void CanReturnListOfFilmsFilteredByYearOfRelease()
        {
            MovieAccess sut = CreateSystemUnderTest();

            IReadOnlyCollection <Movie> movies = sut.GetMovies(null, 2018, Genre.None);

            Assert.Single(movies);
        }
        public void CanReturnListOfFilmsFilteredByGenre()
        {
            MovieAccess sut = CreateSystemUnderTest();

            IReadOnlyCollection <Movie> movies = sut.GetMovies(null, null, Genre.Horror);

            Assert.Equal(2, movies.Count);
        }
        public void CanReturnListOfFilmsFilteredByPartialTitle()
        {
            MovieAccess sut = CreateSystemUnderTest();

            IReadOnlyCollection <Movie> movies = sut.GetMovies("Iron Man", null, Genre.None);

            Assert.Equal(3, movies.Count);
        }
        public void CanReturnListOfFilms()
        {
            MovieAccess sut = CreateSystemUnderTest();

            IReadOnlyCollection <Movie> movies = sut.GetMovies(null, null, Genre.None);

            Assert.Equal(14, movies.Count);
        }
Beispiel #7
0
        public ActionResult MovieMain(int id)
        {
            MovieAccess movieAccess = new MovieAccess();
            var         res         = movieAccess.GetMovieDetails(id);

            // return View(res);
            return(View(res));
        }
Beispiel #8
0
        public ActionResult GetCards()
        {
            MovieAccess ma = new MovieAccess();

            List <homeList_vm> cards = new List <homeList_vm>();

            cards = ma.GetHomeList();
            return(PartialView("MovieCards", cards));
        }
Beispiel #9
0
        // GET: Common/HomeList
        public ActionResult HomeList()
        {
            MovieAccess movieAccess = new MovieAccess();

            var user = User.Identity.Name.ToString();
            var res  = movieAccess.GetHomeList().OrderBy(s => s.DateAdded);

            return(View(res));
        }
Beispiel #10
0
        // GET: Home
        public ActionResult Index()
        {
            MovieAccess ma = new MovieAccess();

            List <homeList_vm> cards = new List <homeList_vm>();

            cards = ma.GetHomeList();
            return(View(cards));
        }
Beispiel #11
0
        public PartialViewResult HomeList_byLatest()
        {
            MovieAccess movieAccess = new MovieAccess();

            var res   = movieAccess.GetHomeList().OrderBy(s => s.DateAdded);
            var count = Math.Ceiling(res.Count() / 6.0);

            ViewBag.Pages = count;
            return(PartialView("_GetCardss", res));
        }
        public void CanReturnTop5Films()
        {
            MovieAccess sut = CreateSystemUnderTest();

            IReadOnlyCollection <Movie> allMovies = sut.GetMovies(null, null, Genre.None)
                                                    .OrderByDescending(a => a.AverageRating)
                                                    .ThenBy(a => a.Title)
                                                    .ToList();

            IReadOnlyCollection <Movie> topFive = sut.GetMoviesByRating(5);

            for (int i = 0; i < 5; i++)
            {
                Assert.Equal(allMovies.ElementAt(i).Id, topFive.ElementAt(i).Id);
            }
        }
Beispiel #13
0
        public ActionResult HomeList_byMood(List <int> moods)
        {
            AgfMembershipProvider membership  = new AgfMembershipProvider();
            MovieAccess           movieAccess = new MovieAccess();
            bool check;

            if (check = System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
            {
                var  user   = User.Identity.Name.ToString();
                Guid?userId = membership.GetUserIdByEmail(user);
                var  res    = movieAccess.GetHomeListForUserSelectedMoods(moods, userId);
                return(PartialView("_GetCardss", res));
            }
            else
            {
                var res = movieAccess.GetHomeListForUserSelectedMoods(moods);
                return(PartialView("_GetCardss", res));
            }
        }
Beispiel #14
0
        public PartialViewResult _RandomMovie()
        {
            AgfMembershipProvider membership  = new AgfMembershipProvider();
            MovieAccess           movieAccess = new MovieAccess();
            bool check;

            if (check = System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
            {
                var  user   = User.Identity.Name.ToString();
                Guid?userId = membership.GetUserIdByEmail(user);
                var  res    = movieAccess.GetRandom(userId).OrderBy(r => Guid.NewGuid()).Take(1);
                return(PartialView("_RandomMovie", res));
            }

            else
            {
                var res = movieAccess.GetRandom().OrderBy(r => Guid.NewGuid()).Take(1);
                return(PartialView("_RandomMovie", res));
            }
        }
Beispiel #15
0
        // GET: Users/AGF100
        public ActionResult AGF100()
        {
            AgfMembershipProvider membership  = new AgfMembershipProvider();
            MovieAccess           movieAccess = new MovieAccess();
            bool check;

            if (check = System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
            {
                var  user   = User.Identity.Name.ToString();
                Guid?userId = membership.GetUserIdByEmail(user);
                var  res    = movieAccess.GetHomeList(userId).OrderByDescending(s => s.GreatnessRating);
                return(View(res));
            }

            else
            {
                var res = movieAccess.GetHomeList().OrderByDescending(s => s.GreatnessRating);
                return(View(res));
            }
        }
        public PartialViewResult _fav()
        {
            AgfMembershipProvider membership  = new AgfMembershipProvider();
            MovieAccess           movieAccess = new MovieAccess();
            bool check;

            if (check = System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
            {
                var  user   = User.Identity.Name.ToString();
                Guid?userId = membership.GetUserIdByEmail(user);
                var  res    = movieAccess.GetUserFavMovies(userId).OrderByDescending(s => s.DateAdded);
                ViewBag.ListTitle = "Favorite";
                var Tcount = res.Count();
                ViewBag.Fcount = Tcount;
                return(PartialView("_UserListContainer", res));
            }

            else
            {
                var res = movieAccess.GetHomeList().OrderByDescending(s => s.DateAdded);
                return(PartialView("_UserListContainer", res));
            }
        }
        // GET: Users/UserProfile
        public ActionResult UserProfile()
        {
            AgfMembershipProvider membership  = new AgfMembershipProvider();
            MovieAccess           movieAccess = new MovieAccess();
            bool check;

            if (check = System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
            {
                var  user       = User.Identity.Name.ToString();
                Guid?userId     = membership.GetUserIdByEmail(user);
                var  res        = movieAccess.GetUserToWatchMovies(userId).OrderByDescending(s => s.DateAdded);
                var  resWatched = movieAccess.GetUserWatchedMovies(userId).OrderByDescending(s => s.DateAdded);
                var  resFav     = movieAccess.GetUserFavMovies(userId).OrderByDescending(s => s.DateAdded);


                var Tcount = res.Count();
                var Wcount = resWatched.Count();
                var Fcount = resFav.Count();


                ViewBag.count  = Tcount;
                ViewBag.Wcount = Wcount;
                ViewBag.Fcount = Fcount;



                ViewBag.ListTitle = "To-Watch";

                return(View(res));
            }

            else
            {
                var res = movieAccess.GetHomeList().OrderByDescending(s => s.DateAdded);
                return(View(res));
            }
        }