Esempio n. 1
0
        public async Task <IActionResult> OnGet([FromServices] ITestService testService, [FromServices] ITestControllerService testControllerService)
        {
            string name        = testService.Name;
            string serviceId   = testService.ServiceId;
            Type   serviceType = testService.ServiceType;

            //var t = await testControllerService.GetQueryResultValueAsync("1", new TestServiceParam
            //{
            //    Age = 11,
            //    Name = "OnGet"
            //});

            //var t = await testControllerService.GetQueryResultValueAsync("1", 1);

            var t = await testControllerService.GetQueryResultValueAsync("1", new int[] { 1, 2, 3 });

            return(new JsonResult(t));


            //var r = await testService.Get();


            ////var r = testService.GetById(1).Result;
            ////var r = await testService.GetQueryResultValueAsync("", new TestServiceParam { });
            ////await testService.PostValueAsync();
            //HttpContext.Response.ContentType = "text/html;charset=utf-8";
            //await HttpContext.Response.WriteAsync(r);
            //return new OkResult();
        }
Esempio n. 2
0
        public async Task <IActionResult> OnGet([FromServices] ITestService testService, [FromServices] ITestControllerService testControllerService)
        {
            var noBaseUrlTestService = HttpContext.RequestServices.GetRequiredService <INoBaseUrlTestService>();

            var baiduHtml = await noBaseUrlTestService.GetBaidu();

            //return Content(baiduHtml);

            string name        = testService.Name;
            string serviceId   = testService.ServiceId;
            Type   serviceType = testService.ServiceType;

            //testService.GetValueVoid(1, "", new TestServiceParam
            //{
            //    State = 1
            //});

            //var t = await testControllerService.GetQueryResultValueAsync("1", new TestServiceParam
            //{
            //    Age = 11,
            //    Name = "OnGet"
            //});

            //var t = await testControllerService.GetQueryResultValueAsync("1", 1);

            var t = await testControllerService.GetQueryResultValueAsync("1", new int[] { 1, 2, 3 });

            return(new JsonResult(t));


            //var r = await testService.Get();


            ////var r = testService.GetById(1).Result;
            ////var r = await testService.GetQueryResultValueAsync("", new TestServiceParam { });
            ////await testService.PostValueAsync();
            //HttpContext.Response.ContentType = "text/html;charset=utf-8";
            //await HttpContext.Response.WriteAsync(r);
            //return new OkResult();
        }