public static List <CommentLink> GetLinks(this CommentLink commentLink) { var links = new List <CommentLink>(); CommentLinkType.GetTypes(commentLink.CommentStatus).ForEach(t => links.Add(new CommentLink { CommentID = commentLink.CommentID, PostID = commentLink.PostID, LinkText = t.Description, ActionMethod = "CommentPartial", CommentStatus = t.Status })); return(links); }
private static CommentInfo GetCommentInfo(IEnumerable <PostEntity> posts, CommentEntity commentEntity, int status) { var info = new CommentInfo { Comment = commentEntity, Post = posts.Single(p => p.PostID == commentEntity.PostID) }; var links = new List <CommentLink>(); CommentLinkType.GetTypes(commentEntity.CommentStatus).ForEach(t => { var methodName = status == int.MaxValue ? "CommentPartial" : "CommentPartialReplacer"; links.Add(new CommentLink { CommentID = commentEntity.CommentID, PostID = commentEntity.PostID, LinkText = t.Description, ActionMethod = methodName, CommentStatus = t.Status }); }); info.Links = links; return(info); }