public IEnumerable <MovieViewModel> GetMovies(int skippedItems = 0, int takenItems = 0) { var movies = Database.GetRepository <Movie>().GetAll(); takenItems = takenItems == 0 ? movies.Count() : takenItems; return(movies.Skip(skippedItems).Take(takenItems).Select(m => MovieViewModel.FromMovie(m)).ToList()); }
public IEnumerable <MovieViewModel> GetMoviesByUserId(string UserId, int skippedItems = 0, int takenItems = 0) { var movies = Database.GetRepository <Movie>().GetAll().Where(m => m.UserProfile.ApplicationUser.Id == UserId); takenItems = takenItems == 0 ? movies.Count() : takenItems; return(movies.Skip(skippedItems).Take(takenItems).Select(m => MovieViewModel.FromMovie(m)).ToList()); }
public MovieViewModel GetMovieById(int id) { var movie = Database.GetRepository <Movie>().FindById(id) ?? throw new ArgumentNullException($"Фильм c id {id} не найден"); return(MovieViewModel.FromMovie(movie)); }
public IEnumerable <MovieViewModel> GetMovies(int skippedItems = 0, int takenItems = 0) => Database.MovieManager.GetMovies(skippedItems, takenItems).ToList().Select(m => MovieViewModel.FromMovie(m));
public MovieViewModel GetMovieById(int id) => MovieViewModel.FromMovie(Database.MovieManager.GetMovieById(id));