Exemple #1
0
        public async Task GetPageByFilterAsync(HttpRequest request, HttpResponse response, ClaimsPrincipal user,
                                               RouteData routeData)
        {
            var correlationId = GetCorrelationId(request);
            var filter        = GetFilterParams(request);
            var paging        = GetPagingParams(request);
            var sort          = GetSortParams(request);

            var result = await _controller.GetPageByFilterAsync(correlationId, filter, paging);

            await SendResultAsync(response, result);
        }
        private ICommand MakeGetPageByFilterCommand()
        {
            return(new Command(
                       "get_dummies",
                       new ObjectSchema()
                       .WithOptionalProperty("correlation_id", typeof(string))
                       .WithOptionalProperty("filter", new FilterParamsSchema())
                       .WithOptionalProperty("paging", new PagingParamsSchema()),
                       async(correlationId, args) =>
            {
                var filter = FilterParams.FromValue(args.Get("filter"));
                var paging = PagingParams.FromValue(args.Get("paging"));

                return await _controller.GetPageByFilterAsync(correlationId, filter, paging);
            }));
        }
Exemple #3
0
        public async Task <DummiesPage> GetDummiesAsync(DummiesPageRequest request, ServerCallContext context)
        {
            var correlationId = request.CorrelationId;
            var filter        = new Commons.Data.FilterParams(request.Filter);
            var paging        = new Commons.Data.PagingParams(request.Paging.Skip, request.Paging.Take, request.Paging.Total);

            var page = await _controller.GetPageByFilterAsync(correlationId, filter, paging);

            var data = new Google.Protobuf.Collections.RepeatedField <ProtoDummy>();

            var response = new DummiesPage {
                Total = page.Total ?? 0
            };

            response.Data.AddRange(page.Data.Select(x => ConvertToPublic(x)));

            return(response);
        }