public PagedResponse GetAlsoOn(int id) { return(_pagingService.GetAlsoOn(new PagedCriteria() { Posts = BlogContextManager.PostSummaries, SearchCriteriaInt = id })); }
private string WritePost(PostSummary post, PostHtml postHtml) { StringBuilder sb = new StringBuilder(); sb.AppendLine("<div class=\"container\">"); //container sb.AppendLine("<div class=\"row\">"); sb.AppendLine("<div class=\"col-md-12\">"); //in the slimmed down version, this is 8 sb.AppendLine(string.Format("<h1 class=\"page-header\">{0}</h1>", post.Title)); sb.AppendLine("<div>"); sb.AppendLine(string.Format("<p class=\"lead\">by <a href=\"{0}/about\">{1}</a></p>", _domain, post.Author)); sb.AppendLine(string.Format("<p><span class=\"glyphicon glyphicon-time\"></span> {0}</p>", post.PostDate.ToString("MM/dd/yyyy"))); sb.AppendLine("<div>"); sb.Append("<small>Posted in </small><span>"); for (int i = 0; i < post.Categories.Count(); i++) { if (post.Categories.Count() == 1 || i + 1 == post.Categories.Count()) { sb.AppendLine(string.Format("<a href=\"{0}/category/{1}\">{1}</a>", _domain, post.Categories[i].Name)); } else { sb.AppendLine(string.Format("<a href=\"{0}/category/{1}\">{1}, </a>", _domain, post.Categories[i].Name)); } } sb.AppendLine("</span>"); sb.Append("<small>Tagged </small><span>"); for (int i = 0; i < post.Tags.Count(); i++) { if (post.Tags.Count() == 1 || i + 1 == post.Tags.Count()) { sb.AppendLine(string.Format("<a href=\"{0}/tag/{1}\">{1}</a>", _domain, post.Tags[i].Name)); } else { sb.AppendLine(string.Format("<a href=\"{0}/tag/{1}\">{1}, </a>", _domain, post.Tags[i].Name)); } } sb.AppendLine("</span>"); sb.AppendLine("</div>"); //post sb.AppendLine("<hr>"); sb.AppendLine(string.Format("<p>{0}</p>", postHtml.Hmtl)); sb.AppendLine("</div>"); sb.AppendLine("</div>"); sb.AppendLine("</div>"); sb.AppendLine("<br />"); //share buttons sb.AppendLine("<div class=\"row\">"); sb.AppendLine("<span>"); sb.AppendLine(string.Format("<a style=\"text-decoration:none;\" href=\"mailto:?Subject={0}&Body=I%20saw%20this%20and%20thought%20of%20you!%20 {1}.html\"><img src=\"assets/images/email.png\" alt=\"Email\" width=\"48\" height=\"48\"/></a>", post.Title, post.Link)); sb.AppendLine(string.Format("<a style=\"text-decoration:none;\" href=\"http://www.linkedin.com/shareArticle?mini=true&url={0}/{1}/{2}.html\" target=\"_blank\"><img src=\"assets/images/linkedin.png\" alt=\"LinkedIn\" width=\"48\" height=\"48\" /></a>", _domain, _staticPageHtmlPath, post.Link)); sb.AppendLine(string.Format("<a style=\"text-decoration:none;\" href=\"https://plus.google.com/share?url={0}/{1}/{2}.html\" target=\"_blank\"><img src=\"assets/images/google.png\" alt=\"Google\" width=\"48\" height=\"48\" /></a>", _domain, _staticPageHtmlPath, post.Link)); sb.AppendLine(string.Format("<a href=\"http://www.facebook.com/sharer.php?u={0}/{1}/{2}.html\" target=\"_blank\"><img src=\"assets/images/facebook.png\" alt=\"Facebook\" width=\"48\" height=\"48\" /></a>", _domain, _staticPageHtmlPath, post.Link)); sb.AppendLine("<a style=\"text-decoration:none;\" href=\"javascript:void((function()%7Bvar%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);document.body.appendChild(e)%7D)());\"><img src=\"assets/images/pinterest.png\" alt=\"Pinterest\" width=\"48\" height=\"48\" /></a>"); sb.AppendLine(string.Format("<a style=\"text-decoration:none;\" href=\"http://reddit.com/submit?url={0}/{1}/{2}.html&title={3}\" target=\"_blank\"><img src=\"assets/images/reddit.png\" alt=\"Reddit\" width=\"48\" height=\"48\" /></a>", _domain, _staticPageHtmlPath, post.Link, post.Title)); sb.AppendLine(string.Format("<a style=\"text-decoration:none;\" href=\"http://www.tumblr.com/share/link?url={0}/{1}/{2}.html&title={3}\" target=\"_blank\"><img src=\"assets/images/tumblr.png\" alt=\"Tumblr\" width=\"48\" height=\"48\" /></a>", _domain, _staticPageHtmlPath, post.Link, post.Title)); sb.AppendLine(string.Format("<a style=\"text-decoration:none;\" href=\"https://twitter.com/share?url={0}/{1}/{2}.html&text={3}&hashtags=grenitausconsulting\" target=\"_blank\"><img src=\"assets/images/twitter.png\" alt=\"Twitter\" width=\"48\" height=\"48\" /></a>", _domain, _staticPageHtmlPath, post.Link, post.Title)); sb.AppendLine("</span>"); sb.AppendLine("</div>"); //also on PagedResponse response = _pagingService.GetAlsoOn(new PagedCriteria() { IsActive = true, Posts = BlogContextManager.PostSummaries, SearchCriteriaInt = post.Id }); if (response.Total > 0) { sb.AppendLine("<hr>"); sb.AppendLine("<div class=\"row\"><h4> Also on Blog.Michaeldeongreen.com...</h4></div>"); sb.AppendLine("<br />"); sb.AppendLine("<div class=\"row\">"); foreach (var p in response.Posts) { sb.AppendLine("<div class=\"col-md-6\">"); sb.AppendLine(string.Format("<h4><a href=\"{0}/post/{1}\">{2}</a></h4>", _domain, p.Link, p.Title)); sb.AppendLine(string.Format("by <a href=\"{0}/about\">{1}</a>", _domain, p.Author)); sb.AppendLine(string.Format("<p><span class=\"glyphicon glyphicon-time\"></span> {0}</p>", p.PostDate.ToString("MM/dd/yyyy"))); sb.AppendLine(string.Format("<p>{0}</p>", p.Snippet)); sb.AppendLine("</div>"); } sb.AppendLine("</div>"); } sb.AppendLine("</div>"); //container return(sb.ToString()); }