• MVC第三波书店实现用户评论展示


    #region 实现用户评论展示
            public ActionResult RecommedPartial(int rid)
            {
                Uri uri = new Uri(path);
                HttpClient httpClient = new HttpClient();
                httpClient.BaseAddress = uri;
                var pashAction = httpClient.GetAsync("api/ReaderComment/rid="+rid);
                var pashResult = pashAction.Result;
                if (pashResult.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    var result = pashResult.Content.ReadAsStringAsync().Result;
                    var list = JsonConvert.DeserializeObject>(result);
                    httpClient.Dispose();
                    return PartialView("RecommedPartial", list);
                }
                else
                {
                    return Content("获取代码错误:" + pashResult.StatusCode);
                }
               
            }
            #endregion

    #region 实现用户评论展示
            public ActionResult RecommedPartial(int rid)
            {
                Uri uri = new Uri(path);
                HttpClient httpClient = new HttpClient();
                httpClient.BaseAddress = uri;
                var pashAction = httpClient.GetAsync("api/ReaderComment/rid="+rid);
                var pashResult = pashAction.Result;
                if (pashResult.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    var result = pashResult.Content.ReadAsStringAsync().Result;
                    var list = JsonConvert.DeserializeObject>(result);
                    httpClient.Dispose();
                    return PartialView("RecommedPartial", list);
                }
                else
                {
                    return Content("获取代码错误:" + pashResult.StatusCode);
                }
               
            }
            #endregion

     //连接redis服务器
            public static  RedisClient client = new RedisClient("192.168.43.30", 6379);
            public static List basketBookList = new List();
            public static string path = "http://localhost:30889/";

  • 相关阅读:
    Linux操作文档——Oracle数据库备份与恢复
    1.2 switch实现两个数的四则运算
    uniapp web-view调整修改高度设置
    【ESD专题】TVS管的选择的误区及钳位电压测试方法
    uview indexList 按字母跳转不了
    安卓逆向之抽象函数public abstract的hook定位处理
    JSON 注释
    【AirPlay】跨子网、不依赖多播的 AirPlay 镜像
    CPU cache:组织及一致性
    Linux 中 ss 命令的使用实例
  • 原文地址:https://blog.csdn.net/m0_74456535/article/details/127936353