Esempio n. 1
0
        public async Task <Result <List <WeatherForecast> > > GetDemo()
        {
            var url = UrlArguments.Create("msgpack", "WeatherForecast/GetWeather");

            var res = await _httpService.GetAsync <Result <List <WeatherForecast> > >(url, HttpMediaType.MessagePack);

            return(Success("0000001", "查询成功", res.data));
        }
Esempio n. 2
0
        public async Task <Result <WeatherForecast> > DeleteDemo()
        {
            var url = UrlArguments.Create("msgpack", "WeatherForecast/DeleteWeather");

            var res = await _httpService.DeleteAsync <Result <WeatherForecast> >(url, HttpMediaType.MessagePack);

            return(Success("0000001", "POST成功", res.data));
        }
Esempio n. 3
0
        //[NoCache]
        //[Route("{id}")]
        //[RazorHtmlStatic(Template = "/static/{controller}/{action}-{id}.html")]
        //public async Task<IActionResult> Index(int id, CancellationToken cancellationToken)
        //{
        //var url = UrlArguments.Create("test", $"/api/CommentsLive/GetPaged")
        //     .Add("aid", 1539)
        //     .Add("commentId", 0)
        //     .Add("pageSize", 10000);

        //var res = await _httpService.GetAsync<ReturnModel>(url, cancellationToken);

        //    return View(res);
        //}

        public async Task <IActionResult> IndexView()
        {
            var url = UrlArguments.Create("test", $"/api/CommentsLive/GetPaged")
                      .Add("aid", 1539)
                      .Add("commentId", 0)
                      .Add("pageSize", 10000);

            var res = await _httpService.GetAsync <ReturnModel>(url);

            return(View(res));
        }
Esempio n. 4
0
        public async Task <Result <WeatherForecast> > PutDemo()
        {
            var url = UrlArguments.Create("msgpack", "WeatherForecast/PutWeather");

            WeatherForecast weather = new WeatherForecast
            {
                Date         = DateTime.UtcNow,
                Summary      = "测试POST",
                TemperatureC = 33
            };

            var res = await _httpService.PutAsync <Result <WeatherForecast>, WeatherForecast>(url, weather, HttpMediaType.MessagePack);

            return(Success("0000001", "POST成功", res.data));
        }
Esempio n. 5
0
        public async Task <ReturnModel> Broadcast([FromBody] BroadcastMessage message)
        {
            var url = UrlArguments.Create("http://127.0.0.1:8080/api/Broadcast/Push");

            return(await _httpService.PostAsync <ReturnModel, BroadcastMessage>(url, message));
        }
Esempio n. 6
0
        public async Task <IActionResult> Index(CancellationToken cancellationToken)
        {
            var list = new List <AdminUsers>();

            for (var ndx = 0; ndx < 10; ndx++)
            {
                var user = new AdminUsers
                {
                    Company       = "test",
                    CreatedTime   = DateTime.Now,
                    Location      = "test",
                    LoginCount    = 0,
                    LoginLastIp   = "127.0.0.1",
                    LoginLastTime = DateTime.Now,
                    Mobile        = "17710146178",
                    Name          = $"徐毅{ndx}",
                    Password      = "******",
                    Picture       = $"徐毅{ndx}",
                    Position      = $"徐毅{ ndx }",
                    Status        = true,
                    UserName      = "******"
                };
                list.Add(user);
            }
            var res0 = _dbAdminUsersServiceProvider.Insert(list.ToArray());
            var re2  = await _dbAdminUsersServiceProvider.BatchUpdateAsync(c => c.Id > 22, c => new AdminUsers()
            {
                Name = "哈德斯", Location = "吹牛逼总监", Company = "大牛逼公司"
            });

            var re1 = await _dbAdminUsersServiceProvider.BatchDeleteAsync(c => c.Id > 22);


            var ur2 = UrlArguments.Create("api/messagepack/add");

            var resData = await _httpMessage.CreateClient("msgtest").SetHeaderAccept(HttpMediaType.MessagePack).PostAsync <User>(ur2, null, cancellationToken);

            if (resData.IsSuccessStatusCode)
            {
            }

            var m = await resData.Content.ReadAsAsync <User>(HttpMediaType.MessagePack);



            var url = UrlArguments.Create("msgpack", "api/messagepack/get");

            var res = await _httpService.GetAsync <User>(url, cancellationToken);

            var postUrl = UrlArguments.Create("msgpack", "api/messagepack/add");

            var res1 = await _httpService.PostAsync <User, User>(postUrl, res, cancellationToken);

            var url1 = UrlArguments.Create("test", $"/api/CommentsLive/GetPaged")
                       .Add("aid", 1539)
                       .Add("commentId", 0)
                       .Add("pageSize", 10000);

            var res2 = await _httpService.GetAsync <ReturnModel>(url1, cancellationToken);

            return(View(res2));
        }