Esempio n. 1
0
        public async Task UpdateMovie(int userId, string movieName, MovieUpdateRankingRequest movieUpdateRankingRequest,
                                      CancellationToken cancellationToken)
        {
            var movieResponse = await _movieRankRepository.GetMovie(userId, movieName, cancellationToken);

            if (movieResponse == null)
            {
                throw new InvalidOperationException($"Invalid userId/MovieName : {userId}/{movieName}");
            }

            var movieUpdateRequest = new MovieUpdateRequest
            {
                Ranking   = movieUpdateRankingRequest.Ranking,
                MovieName = movieName
            };
            await _movieRankRepository.UpdateMovie(userId, movieUpdateRequest, movieResponse, cancellationToken);
        }
Esempio n. 2
0
        public async Task <MovieResponse> GetMovie(int userId, string movieName)
        {
            var response = await _movieRankRepository.GetMovie(userId, movieName);

            return(_map.ToMovieContract(response));
        }
Esempio n. 3
0
        public async Task <MovieResponse> GetMovie(int userId, string movieName)
        {
            MovieResponse result = await _repository.GetMovie(userId, movieName);

            return(_mapper.ToMovieContract(result));
        }
Esempio n. 4
0
        public async Task <MovieResponse> GetMovieFromDatabase(int userId, string movieName)
        {
            MovieDb response = await _movieRankRepository.GetMovie(userId, movieName);

            return(_mapper.ToMovieContract(response));
        }
Esempio n. 5
0
        public async Task DeleteMovieRanking(int userId, string movieName)
        {
            var movie = await _movieRankRepository.GetMovie(userId, movieName);

            await _movieRankRepository.DeleteMovieRanking(movie);
        }