Ejemplo n.º 1
0
        public ActionResult Index()
        {
            var movies = _movieLogic.GetAllMovies(MiscHelper.GetCurrentUserIdOrZero(this)).ToList();

            if (User.Identity.IsAuthenticated)
            {
                movies = _movieLogic.CheckIfMoviesAreFavourites(movies, MiscHelper.GetCurrentUserIdOrZero(this));
            }

            var movieViewModels = ModelToViewModel.ToMovieViewModels(movies);

            foreach (var movie in movieViewModels)
            {
                movie.GenresString = MiscHelper.GetStringFromGenreViewModels(movie.Genres);
            }
            return(View(movieViewModels));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Main action
        /// </summary>
        /// <returns>Main view</returns>
        public IActionResult Index()
        {
            var movies = _movieLogic.GetAllMovies();

            ViewData["Movies"] = movies;

            return(View());
        }
Ejemplo n.º 3
0
        public void GetAllMoviesTest()
        {
            IEnumerable <int> expected = new List <int> {
                1, 2
            };
            List <int> actual = _movieLogic.GetAllMovies(0).Select(movie => movie.MovieId).ToList();

            Assert.AreEqual(expected, actual);
        }
 public IActionResult Index()
 {
     return(View(_movieLogic.GetAllMovies()));
 }