/// <summary> /// 将一条数据转化为ReplyPost_model数据 /// 原贴id 原贴标题 回帖内容的前200字符 回帖帖子的第一张图片 日期 /// </summary> /// <param name="row"></param> /// <returns></returns> public ReplyPost_model ToShortModel(DataRow row) { ReplyPost_model replyPost_model = new ReplyPost_model(); replyPost_model.PostId = (int)row["postId"]; replyPost_model.Post_model.postCaption = row["zhuTieCaption"].ToString(); replyPost_model.replyPostContent = row["replyContent"].ToString(); replyPost_model.replyPostDate = (DateTime)row["datetime"]; replyPost_model.firstPostPhotoUrl = row["photoUrl"].ToString(); return(replyPost_model); }
/// <summary> /// 将一条数据转化为ReplyPost_model数据 /// </summary> /// <param name="row"></param> /// <returns></returns> public ReplyPost_model ToModel(DataRow row) { ReplyPost_model replyPost_model = new ReplyPost_model(); replyPost_model.Commenter.userId = (int)row["userId"]; replyPost_model.Commenter.userName = row["userName"].ToString(); replyPost_model.Commenter.signature = (row["signature"] != DBNull.Value ? row["signature"].ToString() : null); replyPost_model.Commenter.touXiangUrl = row["touXiangUrl"].ToString(); replyPost_model.replyPostId = (int)row["id"]; replyPost_model.PostId = (int)row["postId"]; replyPost_model.replyPostContent = row["content"].ToString(); if (row["datetime"] != null) { replyPost_model.replyPostDate = (DateTime)row["datetime"]; } replyPost_model.replyPostHtmlUrl = row["htmlUrl"].ToString(); replyPost_model.replyPostSupportCount = (int)row["supportCount"]; replyPost_model.commentCount = (row["commentCount"] != DBNull.Value ? (int)row["commentCount"] : 0); return(replyPost_model); }