本文整理汇总了C#中Nop.Core.Domain.Blogs.BlogPost.GetSeName方法的典型用法代码示例。如果您正苦于以下问题:C# BlogPost.GetSeName方法的具体用法?C# BlogPost.GetSeName怎么用?C# BlogPost.GetSeName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nop.Core.Domain.Blogs.BlogPost
的用法示例。
在下文中一共展示了BlogPost.GetSeName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrepareBlogPostModel
private void PrepareBlogPostModel(BlogPostModel model, BlogPost blogPost, bool prepareComments)
{
if (blogPost == null)
throw new ArgumentNullException("blogPost");
if (model == null)
throw new ArgumentNullException("model");
model.Id = blogPost.Id;
model.SeName = blogPost.GetSeName();
model.Title = blogPost.Title;
model.Body = blogPost.Body;
model.AllowComments = blogPost.AllowComments;
model.CreatedOn = _dateTimeHelper.ConvertToUserTime(blogPost.CreatedOnUtc, DateTimeKind.Utc);
model.Tags = blogPost.ParseTags().ToList();
model.NumberOfComments = blogPost.BlogComments.Count;
if (prepareComments)
{
var blogComments = blogPost.BlogComments.Where(pr => pr.IsApproved).OrderBy(pr => pr.CreatedOnUtc);
foreach (var bc in blogComments)
{
var commentModel = new BlogCommentModel()
{
Id = bc.Id,
CustomerId = bc.CustomerId,
CustomerName = bc.Customer.FormatUserName(),
CommentText = bc.CommentText,
CreatedOn = _dateTimeHelper.ConvertToUserTime(bc.CreatedOnUtc, DateTimeKind.Utc),
AllowViewingProfiles = _customerSettings.AllowViewingProfiles && bc.Customer != null && !bc.Customer.IsGuest(),
};
if (_customerSettings.AllowCustomersToUploadAvatars)
{
var customer = bc.Customer;
string avatarUrl = _pictureService.GetPictureUrl(customer.GetAttribute<int>(SystemCustomerAttributeNames.AvatarPictureId), _mediaSettings.AvatarPictureSize, false);
if (String.IsNullOrEmpty(avatarUrl) && _customerSettings.DefaultAvatarEnabled)
avatarUrl = _pictureService.GetDefaultPictureUrl(_mediaSettings.AvatarPictureSize, PictureType.Avatar);
commentModel.CustomerAvatarUrl = avatarUrl;
}
model.Comments.Add(commentModel);
}
}
}
示例2: PrepareBlogPostModel
protected void PrepareBlogPostModel(BlogPostModel model, BlogPost blogPost, bool prepareComments)
{
if (blogPost == null)
throw new ArgumentNullException("blogPost");
if (model == null)
throw new ArgumentNullException("model");
model.Id = blogPost.Id;
model.SeName = blogPost.GetSeName(blogPost.LanguageId, ensureTwoPublishedLanguages: false);
model.Title = blogPost.Title;
model.Body = blogPost.Body;
model.AllowComments = blogPost.AllowComments;
model.CreatedOn = _dateTimeHelper.ConvertToUserTime(blogPost.CreatedOnUtc, DateTimeKind.Utc);
model.Tags = blogPost.ParseTags().ToList();
model.NumberOfComments = blogPost.ApprovedCommentCount;
model.AddNewComment.DisplayCaptcha = _captchaSettings.Enabled && _captchaSettings.ShowOnBlogCommentPage;
if (prepareComments)
{
var blogComments = blogPost.BlogComments.Where(pr => pr.IsApproved).OrderBy(pr => pr.CreatedOnUtc);
foreach (var bc in blogComments)
{
var commentModel = new BlogCommentModel()
{
Id = bc.Id,
CustomerId = bc.CustomerId,
CustomerName = bc.Customer.FormatUserName(),
CommentText = bc.CommentText,
CreatedOn = _dateTimeHelper.ConvertToUserTime(bc.CreatedOnUtc, DateTimeKind.Utc),
AllowViewingProfiles = _customerSettings.AllowViewingProfiles && bc.Customer != null && !bc.Customer.IsGuest(),
};
if (_customerSettings.AllowCustomersToUploadAvatars)
{
commentModel.CustomerAvatarUrl = _pictureService.GetPictureUrl(
bc.Customer.GetAttribute<int>(SystemCustomerAttributeNames.AvatarPictureId),
_mediaSettings.AvatarPictureSize,
_customerSettings.DefaultAvatarEnabled,
defaultPictureType: PictureType.Avatar);
}
model.Comments.Add(commentModel);
}
}
}
示例3: PrepareBlogPostModel
protected virtual void PrepareBlogPostModel(BlogPostModel model, BlogPost blogPost, bool prepareComments)
{
if (blogPost == null)
throw new ArgumentNullException("blogPost");
if (model == null)
throw new ArgumentNullException("model");
model.Id = blogPost.Id;
model.MetaTitle = blogPost.MetaTitle;
model.MetaDescription = blogPost.MetaDescription;
model.MetaKeywords = blogPost.MetaKeywords;
model.SeName = blogPost.GetSeName(blogPost.LanguageId, ensureTwoPublishedLanguages: false);
model.Title = blogPost.Title;
model.Body = blogPost.Body;
model.BodyOverview = blogPost.BodyOverview;
model.AllowComments = blogPost.AllowComments;
model.CreatedOn = _dateTimeHelper.ConvertToUserTime(blogPost.StartDateUtc ?? blogPost.CreatedOnUtc, DateTimeKind.Utc);
model.Tags = blogPost.ParseTags().ToList();
model.NumberOfComments = blogPost.CommentCount;
model.AddNewComment.DisplayCaptcha = _captchaSettings.Enabled && _captchaSettings.ShowOnBlogCommentPage;
if (prepareComments)
{
var blogComments = _blogService.GetBlogCommentsByBlogPostId(blogPost.Id);
foreach (var bc in blogComments)
{
var customer = EngineContext.Current.Resolve<ICustomerService>().GetCustomerById(bc.CustomerId);
var commentModel = new BlogCommentModel
{
Id = bc.Id,
CustomerId = bc.CustomerId,
CustomerName = customer.FormatUserName(),
CommentText = bc.CommentText,
CreatedOn = _dateTimeHelper.ConvertToUserTime(bc.CreatedOnUtc, DateTimeKind.Utc),
AllowViewingProfiles = _customerSettings.AllowViewingProfiles && customer != null && !customer.IsGuest(),
};
if (_customerSettings.AllowCustomersToUploadAvatars)
{
commentModel.CustomerAvatarUrl = _pictureService.GetPictureUrl(
customer.GetAttribute<int>(SystemCustomerAttributeNames.AvatarPictureId),
_mediaSettings.AvatarPictureSize,
_customerSettings.DefaultAvatarEnabled,
defaultPictureType: PictureType.Avatar);
}
model.Comments.Add(commentModel);
}
}
}