public AuthorDrop(IPortalLiquidContext portalLiquidContext, IBlogAuthor author) : this( portalLiquidContext, author.Name, author.EmailAddress, author.Id, url => url.RouteUrl("PublicProfileBlogPosts", new { contactId = author.Id })) { if (author == null) { throw new ArgumentNullException("author"); } }
public static string AuthorUrl(this UrlHelper urlHelper, IBlogAuthor author) { try { return(author == null ? _defaultAuthorUrl : urlHelper.RouteUrl("PublicProfileBlogPosts", new { contactId = author.Id })); } catch { return(_defaultAuthorUrl); } }
public BlogPost(Entity entity, ApplicationPath applicationPath, IBlogAuthor author, BlogCommentPolicy commentPolicy, int commentCount, IEnumerable <IBlogPostTag> tags, IRatingInfo ratingInfo = null) { if (entity == null) { throw new ArgumentNullException("entity"); } if (entity.LogicalName != "adx_blogpost") { throw new ArgumentException(string.Format("Value must have logical name {0}.", entity.LogicalName), "entity"); } if (applicationPath == null) { throw new ArgumentNullException("applicationPath"); } if (commentCount < 0) { throw new ArgumentException("Value can't be negative.", "commentCount"); } if (tags == null) { throw new ArgumentNullException("tags"); } Entity = entity; ApplicationPath = applicationPath; Author = author ?? new NullBlogAuthor(); CommentPolicy = commentPolicy; CommentCount = commentCount; HasExcerpt = !string.IsNullOrWhiteSpace(entity.GetAttributeValue <string>("adx_summary")); Id = entity.Id; IsPublished = entity.GetAttributeValue <bool?>("adx_published").GetValueOrDefault(false); LastUpdatedTime = entity.GetAttributeValue <DateTime?>("modifiedon").GetValueOrDefault(DateTime.UtcNow); PublishDate = entity.GetAttributeValue <DateTime?>("adx_date").GetValueOrDefault(DateTime.UtcNow); Summary = new HtmlString(entity.GetAttributeValue <string>("adx_summary")); Tags = tags.ToArray(); Title = entity.GetAttributeValue <string>("adx_name"); RatingInfo = ratingInfo; var copy = entity.GetAttributeValue <string>("adx_copy"); Content = new HtmlString(HasExcerpt ? "{0}\n{1}".FormatWith(Summary, copy) : copy); }
public ActionResult BlogAuthor() { IBlogAuthor author = null; var item = GetLayoutItem <Item>(); if (item.IsDerived(Templates.BlogArticle.ID)) { var article = item.As <IBlogArticle>(); author = article?.BlogAuthor; } else if (item.IsDerived(Templates.BlogAuthor.ID)) { author = item.As <IBlogAuthor>(); } return(View("~/Views/Feature/Blog/BlogAuthor.cshtml", author)); }