コード例 #1
0
ファイル: TradeController.cs プロジェクト: yxandam/BabyPlan
        public JsonResult GetReplys(int pid)
        {
            int pageIndex = 0;
            int pageSize  = 10;

            int.TryParse(Request["page"], out pageIndex);
            ReplyServiceClient client = new ReplyServiceClient();
            AdvancedResult <PageEntity <GenReply> > response = client.LoadReplyListByBBPostID(pid, pageIndex, pageSize);
            IList <ReplyModel> models = new List <ReplyModel>();
            string             paging = string.Empty;
            int count = 0;

            if (response.Error == AppError.ERROR_SUCCESS)
            {
                count  = response.Data.RecordsCount;
                paging = HtmlFormatHelper.GeneratePagingHtml(response.Data.PageIndex, response.Data.PageSize, response.Data.RecordsCount, "javascript:void(LoadComments({0}))", "下一页", "上一页", null, null, null);

                ViewModelBindOption bindOptions = ViewModelBindOption.DefalutBindOption;
                bindOptions.BindReplyCount    = 0;
                bindOptions.BindRefReplyCount = 1;
                bindOptions.ReplayBindType    = ReplyBindType.Author | ReplyBindType.RefReply;


                models = ReplyModel.BindList(response.Data.Items, bindOptions);
            }
            foreach (ReplyModel r in models)
            {
                if (r.Author != null && r.Author.HeadPic != null)
                {
                    r.Author.HeadPic.DisplaySeting(50, 50);
                }
            }
            return(Json(new { data = models, paging = paging, count = count }, JsonRequestBehavior.AllowGet));
        }