public ActionResult CreatePage(PageViewModel page) { Image img = new Image() { Url = page.PostContent.Image.Url }; PostContent postContent = new PostContent() { Image = img, TemplateBottom = page.PostContent.TemplateBottom, TemplateTop = page.PostContent.TemplateTop }; Page p = new Page() { Name = page.Name, Url = page.Url, PostContent = postContent }; this.context.Pages.Add(p); this.context.SaveChanges(); return(Json(new { success = true }, JsonRequestBehavior.AllowGet)); }
//pass public object Save(PostContent entity) { bool IsSuccess = false; Guid newId = Guid.Empty; using (ISession session = sessionFactory.OpenSession()) { ITransaction trans = session.BeginTransaction(); try { //开始事务处理 newId = (Guid)session.Save(entity); trans.Commit(); if (Guid.Empty != newId) { IsSuccess = true; } } catch (HibernateException) { trans.Rollback(); } } return(IsSuccess); }
/// <summary> /// Changes <see cref="TagHelperOutput"/> to generate nothing. /// </summary> /// <remarks> /// Sets <see cref="TagName"/> to <c>null</c>, and clears <see cref="PreContent"/>, <see cref="Content"/>, /// and <see cref="PostContent"/> to suppress output. /// </remarks> public void SuppressOutput() { TagName = null; PreContent.Clear(); Content.Clear(); PostContent.Clear(); }
public static async Task <GenerationReturn> Validate(PostContent postContent) { var rootDirectoryCheck = UserSettingsUtilities.ValidateLocalSiteRootDirectory(); if (!rootDirectoryCheck.Item1) { return(await GenerationReturn.Error($"Problem with Root Directory: {rootDirectoryCheck.Item2}", postContent.ContentId)); } var commonContentCheck = await CommonContentValidation.ValidateContentCommon(postContent); if (!commonContentCheck.valid) { return(await GenerationReturn.Error(commonContentCheck.explanation, postContent.ContentId)); } var updateFormatCheck = CommonContentValidation.ValidateUpdateContentFormat(postContent.UpdateNotesFormat); if (!updateFormatCheck.isValid) { return(await GenerationReturn.Error(updateFormatCheck.explanation, postContent.ContentId)); } return(await GenerationReturn.Success("Post Content Validation Successful")); }
public static Post FromRequest(AddPostRequest request) { Post post = new Post { Title = request.Title, CreatedDate = DateTime.Now, ModifiedDate = DateTime.Now, Status = ItemStatus.Active, PostType = request.PostType }; if (request.StringContents != null) { foreach (PostContent content in request.StringContents) { PostContent postContent = new PostContent(); postContent.ContentType = content.ContentType; postContent.Content = content.Content; post.StringContents.Add(postContent); } } if (request.MediaContents != null) { foreach (Image content in request.MediaContents) { Image postContent = new Image(); postContent.ImageHash = content.ImageHash; postContent.Discription = content.Discription; post.MediaContents.Add(postContent); } } return(post); }
public async override Task ProcessAsync() { var content = await TagOutput.GetChildContentAsync(); TagOutput.Content.SetHtmlContent(content); if (InputType == InputTypes.Checkbox) { PreContent.SetHtmlContent(new HtmlString("<label for=\"" + EncodeAttribute(InputID) + "\">")); PostContent.SetHtmlContent(new HtmlString(EncodeHTML(Label) + "</label>")); TagName = "div"; this.AddClass("checkbox"); } else { if (Label != null) { PreElement.SetHtmlContent(new HtmlString("<label for=\"" + EncodeAttribute(InputID) + "\">" + Label + "</label>")); } } if (HelpMessage != null) { PostElement.SetHtmlContent(new HtmlString("<small id=\"" + EncodeAttribute(InputID) + "Help\" class=\"form-text text-muted\">" + HelpMessage + "</small>")); } }
/// <summary> /// Sets a content for message /// </summary> /// <param name="template">Template to set content</param> /// <param name="source">Source message where content stores</param> /// <param name="order">Order of sending, where caption always is 0</param> public static void SetContent(TelegramBotClient client, PostTemplate template, Message source, System.Int32 order) { DataBase db = Singleton.GetInstance().Context; PostContent content = null; if (template.PostContent != null) { content = template.PostContent.FirstOrDefault(postContent => postContent.Order == order); } if (content == null) { db.SetPostContent(new PostContent() { Order = order, PostTemplate = template, PostTemplateId = template.Id }); db.Save(); content = db.GetPostContent(template, order); } if (source.Text != null) { Task <Message> mes = client.SendTextMessageAsync(CommandText.bufferChannelId, source.Text); content.MessageId = mes.Result.MessageId; } else { Task <Message> mes = client.ForwardMessageAsync(CommandText.bufferChannelId, source.From.Id, source.MessageId); content.MessageId = mes.Result.MessageId; } db.Save(); }
public async void EditRant(int rantId, PostContent post) { string url = string.Concat(Constants.BaseAddress, Constants.PathRants, rantId); MultipartFormDataContent data = CreateAuthenticatedMultipart(); data.Add(new StringContent(post.Text), "rant"); if (post.Image != null) { data.Add(new ByteArrayContent(post.Image), "image", post.GenerateImageName()); } if (!string.IsNullOrEmpty(post.Tag)) { data.Add(new StringContent(post.Tag), "tags"); } var response = await client.PostAsync(url, data); var responseText = await response.Content.ReadAsStringAsync(); JObject obj = JObject.Parse(responseText); if (owner.CheckSuccess(obj)) { } }
public void LikeContent(PostContent target, User CreateBy, bool LikeAction) { var like = _context.PostInteracts.Where(l => l.Content.Id == target.Id).FirstOrDefault(); if (like == null && LikeAction) { like = new PostInteractStatus() { CreateBy = CreateBy, Content = target, Create = DateTime.Now, }; _context.PostInteracts.Add(like); target.LikeCount++; } else if (like != null && !LikeAction) { _context.PostInteracts.Remove(like); target.LikeCount--; } else { return; } _context.SaveChanges(); }
public static async Task <(GenerationReturn generationReturn, PostContent postContent)> SaveAndGenerateHtml( PostContent toSave, DateTime?generationVersion, IProgress <string> progress) { var validationReturn = await Validate(toSave); if (validationReturn.HasError) { return(validationReturn, null); } Db.DefaultPropertyCleanup(toSave); toSave.Tags = Db.TagListCleanup(toSave.Tags); await Db.SavePostContent(toSave); GenerateHtml(toSave, generationVersion, progress); await Export.WriteLocalDbJson(toSave); DataNotifications.PublishDataNotification("Post Generator", DataNotificationContentType.Post, DataNotificationUpdateType.LocalContent, new List <Guid> { toSave.ContentId }); return(await GenerationReturn.Success($"Saved and Generated Content And Html for {toSave.Title}"), toSave); }
public PostContent CreatePost(PostContent targetPost) { _context.PostContents.Add(targetPost); targetPost.ReplyCount++; _context.PostContents.Update(targetPost); _context.SaveChanges(); return(targetPost); }
public async Task <ActionResult> EditPost(string id, string title, string content) { var newPost = new PostContent { Title = title, Content = content }; var newPostRef = await _postStore.Value.SavePostAsync(id, newPost); return(Redirect($"/Home/ShowPost/{newPostRef.Id}")); }
/// <summary> /// Removes content in specific position in order /// </summary> /// <param name="template">Template </param> /// <param name="order">Order position</param> public static void RemoveContentAt(TelegramBotClient client, PostTemplate template, System.Int32 order) { DataBase db = Singleton.GetInstance().Context; PostContent content = template.PostContent.FirstOrDefault(postContent => postContent.Order == order); template.PostContent.Remove(content); db.Save(); }
public PostContentEditorWindow(PostContent toLoad) { InitializeComponent(); StatusContext = new StatusControlContext(); PostContent = new PostContentEditorContext(StatusContext, toLoad); DataContext = this; AccidentalCloserHelper = new WindowAccidentalClosureHelper(this, StatusContext, PostContent); }
/// <summary> /// メイン処理 /// </summary> static void Main(string[] args) { // 投稿内容 PostContent post = new PostContent(); /** * 以下の内容は必ず編集する事 * ▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼ */ // Application Passwordを設定したユーザ名 const string userName = "******"; // Application Passwordでメモした文字列(ログインパスワードではない) const string applicationPassword = "******"; // WordpressのURL、最後はスラッシュなし const string serverAddress = "http://wordpress.host.hogehoge"; post.title = "投稿テスト"; post.excerpt = "抜粋テスト"; post.content = "本文テスト"; // categoryとtagはslugでのみ記述できる。 var category = new List <string>(); category.Add("category_1"); var tags = new List <string>(); tags.Add("tag_1"); tags.Add("tag_2"); // 投稿時のステータスを決める post.status = status.publish.ToString(); /** * ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲ * ここから下の内容は変更しない */ try { // Slugからidを探し出す(REST APIではIDでしか登録できない) HttpRequest req = new HttpRequest(serverAddress, userName, applicationPassword); post.SetCategories(category, req); post.SetTags(tags, req); // エラーが無ければPost投稿を行う var postResult = Regex.Unescape(req.Post("/wp-json/wp/v2/posts", post.ToJson())); Console.WriteLine(string.Format("投稿に成功しました:{0}", postResult)); } catch (Exception e) { // エラー発生時 Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); } // Enterキー押下を待ち受ける。バッチ実行時は消す。 Console.WriteLine("処理が終了しました、Enterキーを押してください..."); Console.ReadLine(); }
public SinglePostDiv(PostContent dbEntry) { DbEntry = dbEntry; var settings = UserSettingsSingleton.CurrentSettings(); SiteUrl = settings.SiteUrl; SiteName = settings.SiteName; PageUrl = settings.PostPageUrl(DbEntry); }
public void Enqueue([FromBody] PostContent pst) { _logger.LogInformation(pst.Message, new object[0]); var credentials = new BasicAWSCredentials(_config["accessKey"], _config["secretKey"]); var snsClient = new AmazonSimpleNotificationServiceClient(credentials, RegionEndpoint.EUWest1); PublishRequest publishRequest = new PublishRequest(_config["arn"], pst.Message); PublishResponse publishResponse = snsClient.PublishAsync(publishRequest).Result; }
public static void GenerateHtml(PostContent toGenerate, DateTime?generationVersion, IProgress <string> progress) { progress?.Report($"Post Content - Generate HTML for {toGenerate.Title}"); var htmlContext = new SinglePostPage(toGenerate) { GenerationVersion = generationVersion }; htmlContext.WriteLocalHtml(); }
public async Task <ActionResult> Create(string title, string content) { // TODO: Check for validity of post. var newPost = new PostContent { Title = title, Content = content }; var newPostRef = await _postStore.Value.SavePostAsync(newPost); // And go back to the main page. return(Redirect($"/Home/ShowPost/{newPostRef.Id}")); }
private static string TypeToFilterTag(object content) { return(content switch { NoteContent _ => "post", PostContent _ => "post", ImageContent _ => "image", PhotoContent _ => "image", FileContent _ => "file", LinkStream _ => "link", _ => "other" });
public static PostContent GetContent(TelegramBotClient client, PostTemplate template, System.Int32 order) { DataBase db = Singleton.GetInstance().Context; if (template.PostContent == null) { return(null); } PostContent content = db.GetPostContent(template, order); return(content); }
public void ShouldReindexOnReferencedDocumentChange() { using (var store = GetDocumentStore()) { var postsByContent = new Posts_ByContent(); postsByContent.Execute(store); using (var session = store.OpenSession()) { PostContent last = null; for (int i = 0; i < 3; i++) { session.Store(new Post { Id = "posts/" + i }); session.Store(last = new PostContent { Id = "posts/" + i + "/content", Text = i % 2 == 0 ? "HTML 5" : "Javascript" }); } session.SaveChanges(); WaitForIndexing(store); Assert.Equal(2, session.Advanced.DocumentQuery <Post>(postsByContent.IndexName).WhereEquals("Text", "HTML 5").ToList().Count); Assert.Equal(1, session.Advanced.DocumentQuery <Post>(postsByContent.IndexName).WhereEquals("Text", "Javascript").ToList().Count); last.Text = "JSON"; // referenced document change session.Store(last); session.SaveChanges(); WaitForIndexing(store); Assert.Equal(1, session.Advanced.DocumentQuery <Post>(postsByContent.IndexName).WhereEquals("Text", "HTML 5").ToList().Count); Assert.Equal(1, session.Advanced.DocumentQuery <Post>(postsByContent.IndexName).WhereEquals("Text", "Javascript").ToList().Count); Assert.Equal(1, session.Advanced.DocumentQuery <Post>(postsByContent.IndexName).WhereEquals("Text", "JSON").ToList().Count); session.Delete(last); // referenced document delete session.SaveChanges(); WaitForIndexing(store); Assert.Equal(0, session.Advanced.DocumentQuery <Post>(postsByContent.IndexName).WhereEquals("Text", "JSON").ToList().Count); } } }
public async Task <IActionResult> AddPost(PostContent model) { if (ModelState.IsValid) { var post = new Post { content = model, authorID = Convert.ToInt32(_userManager.GetUserId(HttpContext.User)), datePublished = DateTime.UtcNow }; _context.Post.Add(post); await _context.SaveChangesAsync(); } return(RedirectToAction("Index", "Home")); }
private void Browse() { var dlg = DialogsUtility.CreateOpenFileDialog("Select an image"); var types = from i in PostContent.GetSupportedTypes() select "*." + i; string supported = string.Join(";", types); DialogsUtility.AddExtension(dlg, "Images", supported); dlg.ShowDialog(); if (!string.IsNullOrEmpty(dlg.FileName)) { ImagePath = dlg.FileName; } }
public void ToBlogPost_CreatesBlogPost() { var postContent = new PostContent { Title = "Title", Slug = "slug", PublishedAt = new DateTime(2021, 1, 1), Content = new PostContent.ContentContent { Html = "<p>Hello</p>" } }; Assert.Equal( new BlogPost("Title", "slug", "<p>Hello</p>", new DateTime(2021, 1, 1)), postContent.ToBlogPost()); }
public PostContentEditorWindow(PostContent toLoad) { InitializeComponent(); StatusContext = new StatusControlContext(); StatusContext.RunFireAndForgetBlockingTaskWithUiMessageReturn(async() => { PostContent = await PostContentEditorContext.CreateInstance(StatusContext, toLoad); PostContent.RequestContentEditorWindowClose += (_, _) => { Dispatcher?.Invoke(Close); }; AccidentalCloserHelper = new WindowAccidentalClosureHelper(this, StatusContext, PostContent); await ThreadSwitcher.ResumeForegroundAsync(); DataContext = this; }); }
public PostContentEditorContext(StatusControlContext statusContext, PostContent postContent) { StatusContext = statusContext ?? new StatusControlContext(); HelpContext = new HelpDisplayContext(CommonFields.TitleSlugFolderSummary + BracketCodeHelpMarkdown.HelpBlock); SaveAndCreateLocalCommand = new Command(() => StatusContext.RunBlockingTask(SaveAndCreateLocal)); SaveUpdateDatabaseCommand = new Command(() => StatusContext.RunBlockingTask(SaveToDbWithValidation)); ViewOnSiteCommand = new Command(() => StatusContext.RunBlockingTask(ViewOnSite)); ExtractNewLinksCommand = new Command(() => StatusContext.RunBlockingTask(() => LinkExtraction.ExtractNewAndShowLinkStreamEditors( $"{BodyContent.BodyContent} {UpdateNotes.UpdateNotes}", StatusContext.ProgressTracker()))); StatusContext.RunFireAndForgetTaskWithUiToastErrorReturn(async() => await LoadData(postContent)); }
public PostContent ToPostContent() { var pc = new PostContent(Text); if (!string.IsNullOrEmpty(Tags)) { pc.SetTag(Tags); } if (!string.IsNullOrEmpty(ImagePath)) { byte[] bytes = File.ReadAllBytes(ImagePath); pc.AddImage(bytes, ImagePath); } return(pc); }
public static Db.PostContent ToEntity(PostContent postContent) { return postContent == null ? null : new Db.PostContent { PostContentId = postContent.Id, PostId = postContent.PostId, Media = null, PostContentText = postContent.PostContentText, PostContentTitle = postContent.PostContentTitle, MediaId = postContent.Media == null ? 0 : postContent.Media.Id, CreatedBy = postContent.CreatedBy, CreatedDate = postContent.CreatedDate, ModifiedBy = postContent.ModifiedBy, ModifiedDate = postContent.ModifiedDate }; }
public void PostContent_CanBeDeserializedFromStrapiJson() { var strapiJson = @"{""id"":1,""title"":""Title"",""slug"":""slug"",""content"":""Hello\\n"",""published_at"":""2021-03-23T06:11:20.018Z"",""created_at"":""2021-03-23T06:11:10.154Z"",""updated_at"":""2021-03-23T06:11:20.035Z""}"; var expected = new PostContent { Title = "Title", Slug = "slug", ContentMarkdown = "Hello\\n", PublishedAt = new DateTime(2021, 3, 23, 6, 11, 20, 18, DateTimeKind.Utc) }; // Act var result = JsonSerializer.Deserialize <PostContent>(strapiJson); Assert.Equal(expected, result); }
private static Result CreatePost(string title, string summary, string text, DateTime dateBeg, DateTime dateEnd) { var onePostContent = PostContent.Create(title, summary, text); var twoPostContent = PostContent.Create(title, summary, text); var publishingDates = PublishingDates.Create(dateBeg, dateEnd); var category = Category.Create("Programming"); var tag = Tag.Create("c#"); return(Result.Combine(onePostContent, twoPostContent, publishingDates, category, tag) .OnSuccess(() => new Post(onePostContent.Value, publishingDates.Value)) .OnSuccess(post => { post.AddTag(tag.Value).OnSuccess(t => WriteLine(t.Title)); post.AddCategory(category.Value).OnSuccess(() => WriteLine("category added success")); }).OnFailure(WriteLine) .OnBoth(System.Console.WriteLine)); }
//pass public object Save(PostContent entity) { bool IsSuccess=false; Guid newId = Guid.Empty; using (ISession session=sessionFactory.OpenSession()) { ITransaction trans = session.BeginTransaction(); try { //开始事务处理 newId=(Guid)session.Save(entity); trans.Commit(); if (Guid.Empty != newId) IsSuccess = true; } catch(HibernateException) { trans.Rollback(); } } return IsSuccess; }
public List<PostContent> GetPhotoListByPage(int type, int categoryId, string address, string orderby, int startIndex, int endIndex) { List<PostContent> list = new List<PostContent>(); DataSet set = this.dal.GetListByPageEx(type, categoryId, address, orderby, startIndex, endIndex); List<string> values = new List<string>(); Maticsoft.BLL.SNS.Comments comments = new Maticsoft.BLL.SNS.Comments(); if ((set != null) && (set.Tables.Count > 0)) { Action<PostContent> action = null; DataTable table = set.Tables[0]; foreach (DataRow row in table.Rows) { PostContent item = new PostContent { Type = 0, TargetId = Convert.ToInt32(row["PhotoID"]), TargetName = row["PhotoName"].ToString(), TargetDescription = (row["Description"] != null) ? row["Description"].ToString() : "", CommentCount = Convert.ToInt32(row["CommentCount"]), FavouriteCount = Convert.ToInt32(row["FavouriteCount"]), ThumbImageUrl = row["ThumbImageUrl"].ToString(), TopCommentsId = (row["TopCommentsId"] != null) ? row["TopCommentsId"].ToString() : "" }; list.Add(item); if (!string.IsNullOrEmpty(item.TopCommentsId)) { values.Add(item.TopCommentsId); } } List<Maticsoft.Model.SNS.Comments> commentList = comments.GetCommentByIds(string.Join(",", values).TrimEnd(new char[] { ',' }), 1); if (commentList == null) { return list; } if (action == null) { action = delegate (PostContent img) { List<Maticsoft.Model.SNS.Comments> list = commentList.FindAll(xx => (xx.TargetId == img.TargetId) && (xx.Type == 1)); if (list != null) { img.CommentList = list; } }; } list.ForEach(action); } return list; }
public List<PostContent> GetListByKeyWord(string q, string orderby, int startIndex, int endIndex, string area = "") { DataSet set; new List<Maticsoft.Model.SNS.Photos>(); StringBuilder builder = new StringBuilder(); builder.Append(" Status =1 "); if (!string.IsNullOrEmpty(q)) { builder.Append(" and (Tags Like '%" + q + "%' or Description like '%" + q + "%')"); } if (!string.IsNullOrEmpty(area)) { builder.Append(" and (PhotoAddress like '%" + area + "%' )"); } string str = orderby; if (str != null) { if (!(str == "popular")) { if (str == "new") { orderby = "CreatedDate"; goto Label_00D0; } if (str == "hot") { orderby = "CommentCount"; goto Label_00D0; } } else { orderby = "FavouriteCount"; goto Label_00D0; } } orderby = "FavouriteCount"; Label_00D0: set = this.dal.GetListByPage(builder.ToString(), orderby, startIndex, endIndex); List<PostContent> list = new List<PostContent>(); List<string> values = new List<string>(); Maticsoft.BLL.SNS.Comments comments = new Maticsoft.BLL.SNS.Comments(); if ((set != null) && (set.Tables.Count > 0)) { Action<PostContent> action = null; DataTable table = set.Tables[0]; foreach (DataRow row in table.Rows) { PostContent item = new PostContent { Type = 0, TargetId = Convert.ToInt32(row["PhotoID"]), TargetName = row["PhotoName"].ToString(), TargetDescription = (row["Description"] != null) ? row["Description"].ToString() : "", CommentCount = Convert.ToInt32(row["CommentCount"]), FavouriteCount = Convert.ToInt32(row["FavouriteCount"]), ThumbImageUrl = row["ThumbImageUrl"].ToString(), TopCommentsId = (row["TopCommentsId"] != null) ? row["TopCommentsId"].ToString() : "", StaticUrl = (row["StaticUrl"] != null) ? row["StaticUrl"].ToString() : "" }; list.Add(item); if (!string.IsNullOrEmpty(item.TopCommentsId)) { values.Add(item.TopCommentsId); } } List<Maticsoft.Model.SNS.Comments> commentList = comments.GetCommentByIds(string.Join(",", values).TrimEnd(new char[] { ',' }), 1); if (commentList == null) { return list; } if (action == null) { action = delegate (PostContent img) { List<Maticsoft.Model.SNS.Comments> list = commentList.FindAll(xx => (xx.TargetId == img.TargetId) && (xx.Type == 1)); if (list != null) { img.CommentList = list; } }; } list.ForEach(action); } return list; }
public bool Update(PostContent post) { bool IsUpdated = false; using (ISession session=sessionFactory.OpenSession()) { ITransaction trans = session.BeginTransaction(); try { session.Update(post); trans.Commit(); if (trans.WasCommitted) { IsUpdated = true; } } catch (Exception) { trans.Rollback(); throw; } } return IsUpdated; }
public List<PostContent> GetAlbumImgListByPage(int albumID, int startIndex, int endIndex, int type = -1) { List<PostContent> list = new List<PostContent>(); DataSet set = this.dal.GetAlbumImgListByPage(albumID, "", startIndex, endIndex, type); List<string> values = new List<string>(); Maticsoft.BLL.SNS.Comments comments = new Maticsoft.BLL.SNS.Comments(); if ((set != null) && (set.Tables.Count > 0)) { Action<PostContent> action = null; DataTable table = set.Tables[0]; foreach (DataRow row in table.Rows) { PostContent item = new PostContent { TargetId = Convert.ToInt32(row["TargetID"]), TargetName = row["TargetName"].ToString(), TargetDescription = (row["Description"] != null) ? row["Description"].ToString() : "", CommentCount = Convert.ToInt32(row["CommentCount"]), FavouriteCount = Convert.ToInt32(row["FavouriteCount"]), ThumbImageUrl = row["ThumbImageUrl"].ToString(), Price = Globals.SafeDecimal(row["Price"].ToString(), (decimal) -1M), Type = (int) row["Type"], TopCommentsId = (row["TopCommentsId"] != null) ? row["TopCommentsId"].ToString() : "" }; list.Add(item); if (!string.IsNullOrEmpty(item.TopCommentsId)) { values.Add(item.TopCommentsId); } } List<Maticsoft.Model.SNS.Comments> commentList = comments.GetCommentByIds(string.Join(",", values).TrimEnd(new char[] { ',' }), 1); if (commentList == null) { return list; } if (action == null) { action = delegate (PostContent img) { List<Maticsoft.Model.SNS.Comments> list = commentList.FindAll(xx => (xx.TargetId == img.TargetId) && (xx.Type == ((img.Type == 0) ? 1 : 2))); if (list != null) { img.CommentList = list; } }; } list.ForEach(action); } return list; }