Beispiel #1
0
        public override async Task <LoadResponse> Load(LoadRequest request, ServerCallContext context)
        {
            var votes = await _mediator.Send(new VoteCountQuery(request.SubjectId));

            var response = new LoadResponse();

            response.Votes.AddRange(votes.Select(ToResponse));
            return(response);
        }
        public override async Task <LoadResponse> Load(LoadRequest request, ServerCallContext context)
        {
            using (var scope = _scopeFactory.CreateScope())
            {
                var mediator = scope.ServiceProvider.GetRequiredService <IMediator>();
                var votes    = await mediator.Send(new VoteCountQuery(request.SubjectId));

                var response = new LoadResponse();
                response.Votes.AddRange(votes.Select(ToResponse));
                return(response);
            }
        }