コード例 #1
0
        public async Task GetByIdAsync(HttpRequest request, HttpResponse response, ClaimsPrincipal user,
                                       RouteData routeData)
        {
            var correlationId = GetCorrelationId(request);
            var parameters    = GetParameters(request);
            var id            = parameters.GetAsNullableString("dummy_id") ?? parameters.GetAsNullableString("id");

            var result = await _controller.GetOneByIdAsync(correlationId, id);

            await SendResultAsync(response, result);
        }
 private ICommand MakeGetOneByIdCommand()
 {
     return(new Command(
                "get_dummy_by_id",
                new ObjectSchema()
                .WithRequiredProperty("dummy_id", Commons.Convert.TypeCode.String),
                async(correlationId, args) =>
     {
         var dummyId = args.GetAsString("dummy_id");
         return await _controller.GetOneByIdAsync(correlationId, dummyId);
     }));
 }
コード例 #3
0
        public async Task <ProtoDummy> GetDummyByIdAsync(DummyIdRequest request, ServerCallContext context)
        {
            var item = await _controller.GetOneByIdAsync(request.CorrelationId, request.DummyId);

            return(ConvertToPublic(item));
        }