示例#1
0
        public object GetBookList([FromQuery(Name = "page")] string page, [FromQuery(Name = "limit")] string limit, [FromQuery(Name = "txtname")] string bookName)
        {
            //实例化RestRequest
            var request = new RestRequest("/demo/v1/book/getbookdata");

            //增加参数
            request.AddQueryParameter("page", page);
            request.AddQueryParameter("limit", limit);
            request.AddQueryParameter("bookName", bookName);
            //执行请求
            var responseData = RestHelper.ExecuteGet <Response>("Lobster.Service.Demo", request);

            if (responseData != null)
            {
                var data  = responseData.GetData <dynamic>("data");
                var count = Convert.ToInt32(responseData.GetData <string>("count"));
                if (count > 0)
                {
                    return(ToTableJson(count, data));
                }
                else
                {
                    return(new Response(1, "无数据"));
                }
            }
            else
            {
                return(new Response(1, "无数据"));
            }
        }