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); }
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); } }