Exemple #1
0
 public void Configuration(IAppBuilder app)
 {
     app.Run(context =>
     {
         var result = ServiceExecuter.Execute(context.Request.ToServiceInfo());
         context.Response.ContentType = "application/json";
         return(context.Response.WriteAsync(JsonConvert.SerializeObject(result.Result)));
     });
 }
Exemple #2
0
        private void StringRequesthandler(AppSession session, StringRequestInfo requestinfo)
        {
            var args = requestinfo.Body.Split('/');
            var info = new RequestedServiceInfo
            {
                Name       = args[0],
                Action     = args[1],
                Paramaters = string.Join("/", args.Skip(2).Take(args.Length - 2))
            };
            var result = ServiceExecuter.Execute(info);

            Console.WriteLine();
            session.Send($"{JsonConvert.SerializeObject(result.Result)}\r\n");
        }