本文整理汇总了C#中Post.AddTag方法的典型用法代码示例。如果您正苦于以下问题:C# Post.AddTag方法的具体用法?C# Post.AddTag怎么用?C# Post.AddTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Post
的用法示例。
在下文中一共展示了Post.AddTag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: setup_sample_post
private void setup_sample_post(User user)
{
var oxiteTag = new Tag {Name = "Oxite", CreatedDate = DateTime.Parse("12 NOV 2008")};
var defaultPost = new Post
{
Title = "World.Hello()",
Slug = "World_Hello",
BodyShort = "Welcome to Oxite! This is a sample application targeting developers built on <a href=\"http://asp.net/mvc\">ASP.NET MVC</a>. Make any changes you like. If you build a feature you think other developers would be interested in and would like to share your code go to the <a href=\"http://www.codeplex.com/oxite\">Oxite Code Plex project</a> to see how you can contribute.<br /><br />To get started, sign in with \"Admin\" and \"pa$$w0rd\" and click on the Admin tab.<br /><br />For more information about <a href=\"http://oxite.net\">Oxite</a> visit the default <a href=\"/About\">About</a> page.",
Body = "Welcome to Oxite! This is a sample application targeting developers built on <a href=\"http://asp.net/mvc\">ASP.NET MVC</a>. Make any changes you like. If you build a feature you think other developers would be interested in and would like to share your code go to the <a href=\"http://www.codeplex.com/oxite\">Oxite Code Plex project</a> to see how you can contribute.<br /><br />To get started, sign in with \"Admin\" and \"pa$$w0rd\" and click on the Admin tab.<br /><br />For more information about <a href=\"http://oxite.net\">Oxite</a> visit the default <a href=\"/About\">About</a> page.",
Published = DateTime.Parse("2008-12-05 09:29:03.270"),
User = user
};
defaultPost.AddTag(oxiteTag);
_repository.Save(defaultPost);
var defaultPost1 = new Post
{
Title = "World.Hello()",
Slug = "World_Hello2",
BodyShort = "Welcome to Oxite! This is a sample application targeting developers built on <a href=\"http://asp.net/mvc\">ASP.NET MVC</a>. Make any changes you like. If you build a feature you think other developers would be interested in and would like to share your code go to the <a href=\"http://www.codeplex.com/oxite\">Oxite Code Plex project</a> to see how you can contribute.<br /><br />To get started, sign in with \"Admin\" and \"pa$$w0rd\" and click on the Admin tab.<br /><br />For more information about <a href=\"http://oxite.net\">Oxite</a> visit the default <a href=\"/About\">About</a> page.",
Body = "Welcome to Oxite! This is a sample application targeting developers built on <a href=\"http://asp.net/mvc\">ASP.NET MVC</a>. Make any changes you like. If you build a feature you think other developers would be interested in and would like to share your code go to the <a href=\"http://www.codeplex.com/oxite\">Oxite Code Plex project</a> to see how you can contribute.<br /><br />To get started, sign in with \"Admin\" and \"pa$$w0rd\" and click on the Admin tab.<br /><br />For more information about <a href=\"http://oxite.net\">Oxite</a> visit the default <a href=\"/About\">About</a> page.",
Published = DateTime.Parse("2008-12-05 09:29:03.270"),
User = user
};
defaultPost1.AddTag(oxiteTag);
defaultPost1.AddTag(new Tag { Name = "AltOxite", CreatedDate = DateTime.Parse("30 DEC 2008") });
defaultPost1.AddComment(new Comment { Post = defaultPost1, User = user, Body = "test comment", Published = DateTime.Parse("31 DEC 2008") });
_repository.Save(defaultPost1);
}