예제 #1
0
        public override async Task <RankingResponse> List(ListRequest request, ServerCallContext context)
        {
            var ranking = await _mediator.Send(new TopRankingQuery(request.OptionName));

            var response = new RankingResponse();

            response.Votes.AddRange(ranking.Select(ToResponse));
            return(response);
        }
예제 #2
0
        public override async Task <RankingResponse> List(ListRequest request, ServerCallContext context)
        {
            using (var scope = _scopeFactory.CreateScope())
            {
                var mediator = scope.ServiceProvider.GetRequiredService <IMediator>();
                var ranking  = await mediator.Send(new TopRankingQuery(request.OptionName));

                var response = new RankingResponse();
                response.Votes.AddRange(ranking.Select(ToResponse));
                return(response);
            }
        }