コード例 #1
0
        public async Task <IActionResult> Save(MovieRatingDto movieRatingDto)
        {
            movieRatingDto.UserId = ActiveUser.Get().UserId;
            var newMovieRating = await _movieRatingService.Insert(_mapper.Map <MovieRating>(movieRatingDto));

            return(Created(string.Empty, _mapper.Map <MovieRatingDto>(newMovieRating)));
        }
コード例 #2
0
        public async Task <List <MovieRating> > GetByMovieId(int movieId)
        {
            var user  = ActiveUser.Get();
            var query = await GetAllAsync();

            return(await query.Where(x => x.MovieId == movieId && x.UserId == user.UserId).ToListAsync());
        }