• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# BlogPost类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中BlogPost的典型用法代码示例。如果您正苦于以下问题:C# BlogPost类的具体用法?C# BlogPost怎么用?C# BlogPost使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BlogPost类属于命名空间,在下文中一共展示了BlogPost类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Create

        public ActionResult Create(BlogPost blogPost)
        {
            RavenSession.Store(blogPost);
              RavenSession.SaveChanges();

              return RedirectToAction("Index");
        }
开发者ID:haiku80,项目名称:raventest,代码行数:7,代码来源:BlogPostsController.cs


示例2: ConvertPost

        public static BlogPost ConvertPost(BloggerPostData post)
        {
            if (post == null)
            {
                throw new ArgumentNullException(nameof(post));
            }

            var author = new BlogAuthor
                             {
                                 ImageUrl = post.Author?.Image?.Url,
                                 Name = post.Author?.DisplayName,
                                 SourceId = post.Author?.Id,
                                 Url = post.Author?.Url
                             };

            // Properties set by BlogSyncServiceUpdatePostsHelper: BlavenId, UrlSlug
            var blogPost = new BlogPost
                               {
                                   BlogAuthor = author,
                                   Content = post.Content,
                                   Hash = GetBlogPostHash(post),
                                   PublishedAt = post.Published,
                                   SourceId = post.Id,
                                   SourceUrl = post.Url,
                                   BlogPostTags =
                                       post.Labels?.Select(x => new BlogPostTag(x)).ToList() ?? new List<BlogPostTag>(),
                                   Title = post.Title,
                                   UpdatedAt = post.Updated
                               };
            return blogPost;
        }
开发者ID:sebnilsson,项目名称:Blaven,代码行数:31,代码来源:BloggerDataConverter.cs


示例3: Initialize

		/// <summary>
		/// Retrieving all blog posts here, so this only has to be called once.
		/// </summary>
		internal ICollection<BlogPost> Initialize(bool redirect)
		{
			var blog = Retriever.GetBlog(_blogService);
			var blogPosts = _blogPostService.Get(blog, VersionOptions.Published);
			_allBlogPosts = new List<BlogPost>();
			string redirects = string.Empty;
			foreach (var blogPostPart in blogPosts)
			{
				if (redirect) 
				{
					string currentSlug = GetUrl(blogPostPart);
					string redirectRule = "<location path=\"{0}\"><system.webServer><httpRedirect enabled=\"true\" destination=\"http://jan-v.nl/post/{0}\" httpResponseStatus=\"Permanent\" /></system.webServer></location>";
					redirects = redirects + string.Format(redirectRule, currentSlug);
				}
				else {

					var blogPost = new BlogPost();
					blogPost.Title = blogPostPart.Title;
					blogPost.Content = blogPostPart.Text;
					blogPost.PubDate = blogPostPart.PublishedUtc.Value;
					blogPost.LastModified = blogPostPart.PublishedUtc.Value;
					//blogPost.Categories = blogPostPart.;
					blogPost.Slug = GetUrl(blogPostPart);
					blogPost.Author = blogPostPart.Creator.UserName;
					blogPost.IsPublished = true;

					_allBlogPosts.Add(blogPost);
					Storage.Save(blogPost, string.Format("C:\\BlogPosts\\{0}.xml", blogPost.Slug));
				}
				
			}
			return _allBlogPosts;
		}
开发者ID:Jandev,项目名称:JanVNL.Migrate,代码行数:36,代码来源:GetBlogPost.cs


示例4: bindPostOne

        private void bindPostOne( IBlock listBlock, BlogPost post )
        {
            String status = string.Empty;
               // if (post.IsTop == 1) status = "<span class=\"lblTop\">[" + lang( "sticky" ) + "]</span>";
             //   if (post.IsPick == 1) status = status + "<span class=\"lblTop\">[" + lang( "picked" ) + "]</span>";

               // listBlock.Set( "blogpost.Status", status );
            listBlock.Set( "blogpost.Title", post.Title );
            listBlock.Set( "blogpost.Url", alink.ToAppData( post ) );
            listBlock.Set( "blogpost.Body", strUtil.ParseHtml( post.Content, 300 ) );
            listBlock.Set( "author", ctx.owner.obj.Name );
            listBlock.Set( "authroUrl", Link.ToMember( ctx.owner.obj ) );
            listBlock.Set( "blogpost.CreateTime", post.Created.ToShortTimeString() );
            listBlock.Set( "blogpost.CreateDate", post.Created.ToShortDateString() );
            listBlock.Set( "blogpost.Hits", post.Hits );
            listBlock.Set( "blogpost.ReplyCount", post.Replies );
            if (ctx.viewer.IsLogin && (ctx.viewer.Id == ctx.owner.Id))
            {
                listBlock.Set("EditUrlStyle", "");

            }
            else
            {
                listBlock.Set("EditUrlStyle", "display:none");

            }
            listBlock.Set("blogpost.EditUrl", to(new Admin.PostController().Edit, post.Id));
        }
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:28,代码来源:CategoryController.cs


示例5: bindPostOne

        private void bindPostOne( IBlock listBlock, BlogPost post, BlogSetting s ) {

            String status = string.Empty;
            if (post.IsTop == 1) status = "<span class=\"lblTop\">[" + lang( "sticky" ) + "]</span>";
            if (post.IsPick == 1) status = status + "<span class=\"lblTop\">[" + lang( "picked" ) + "]</span>";
            if (post.AttachmentCount > 0) {
                status = status + string.Format( "<span><img src=\"{0}\"/></span>", strUtil.Join( sys.Path.Img, "attachment.gif" ) );
            }

            String postLink = alink.ToAppData( post );

            listBlock.Set( "blogpost.Status", status );
            listBlock.Set( "blogpost.Title", post.Title );
            listBlock.Set( "blogpost.Url", postLink );

            String body = s.ListMode == BlogListMode.Full ? post.Content : strUtil.ParseHtml( post.Content, s.ListAbstractLength );
            listBlock.Set( "blogpost.Body", body );
            listBlock.Set( "author", ctx.owner.obj.Name );
            listBlock.Set( "authroUrl", Link.ToMember( ctx.owner.obj ) );
            listBlock.Set( "blogpost.CreateTime", post.Created.ToShortTimeString() );
            listBlock.Set( "blogpost.CreateDate", post.Created.ToShortDateString() );
            listBlock.Set( "blogpost.Hits", post.Hits );

            String replies = post.Replies > 0 ?
                string.Format( "<a href=\"{0}\">{1}(<span class=\"blogItemReviews\">{2}</span>)</a>", postLink + "#comments", lang( "comment" ), post.Replies ) :
                string.Format( "<a href=\"{0}\">发表评论</a>", postLink + "#comments" );
            listBlock.Set( "blogpost.ReplyCount", replies );


            listBlock.Set( "blogpost.CategoryName", post.Category.Name );
            listBlock.Set( "blogpost.CategoryLink", to( new CategoryController().Show, post.Category.Id ) );

            String tags = post.Tag.List.Count > 0 ? "tag:" + post.Tag.HtmlString : "";
            listBlock.Set( "blogpost.TagList", tags );
        }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:35,代码来源:BlogController.cs


示例6: Index_GIVEN_BlogPostRepository_Has_1_BlogSummary_THEN_Sets_BlogSummaryViewModel_To_Have_Same_Values

        public void Index_GIVEN_BlogPostRepository_Has_1_BlogSummary_THEN_Sets_BlogSummaryViewModel_To_Have_Same_Values()
        {
            const string title = "Title";
            const string description = "Description";
            var url = new Uri("http://www.jumbleblocks.co.uk/noimage.jpg");
            var publishedDate = DateTime.Now;
            var author = new BlogUser { Forenames = "Authors", Surname = "Name" };

            var blogPosts = new BlogPost[]
            {
                new BlogPost(title, description, "full article", new ImageReference(1, url:url.AbsoluteUri), publishedDate, author)
            };

            var mockedBlogPostRepository = new Mock<IBlogPostRepository>();
            mockedBlogPostRepository.Setup(r => r.GetPosts(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<IEnumerable<string>>())).Returns(blogPosts);
            mockedBlogPostRepository.Setup(r => r.Count).Returns(blogPosts.Length);

            var controller = MockCreators.CreateBlogPostController(blogPostRepository: mockedBlogPostRepository.Object);

            var result = controller.Index() as ViewResult;

            var model = (FrontPageModel)result.Model;
            model.Summaries.First().Title.ShouldEqual(title);
            model.Summaries.First().Description.ShouldEqual(description);
            model.Summaries.First().ImageUrl.ShouldEqual(url);
            model.Summaries.First().PublishedDate.ShouldEqual(publishedDate);
            model.Summaries.First().AuthorsName.ShouldEqual(author.FullName);
        }
开发者ID:AndyCC,项目名称:Jumbleblocks-website,代码行数:28,代码来源:BlogFrontPageTests.cs


示例7: getStatus

 private String getStatus( BlogPost post )
 {
     //if (pickedService.IsPicked( post )) return "<span class='red'>[" + lang( "recommend" ) + "]</span>&nbsp;";
     //return "";
     if (post.IsPick > 0) return "<span class='red'>[" + lang("recommend") + "]</span>&nbsp;";
     return "";
 }
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:7,代码来源:MainController.cs


示例8: Post

 public async Task<IHttpActionResult> Post(BlogPost m)
 {
     if (!ModelState.IsValid)
         return BadRequest(ModelState);
     m.CreateTime = System.DateTimeOffset.Now;
     //TODO:获取当前用户
     m.UserId = "{B0FBB2AC-3174-4E5A-B772-98CF776BD4B9}";
     //添加博客
     m = db.BlogPost.Add(m);
     try
     {
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         throw new Exception("发布博客失败:" + ex.Message);
     }
      int postId =m.Id;
     //添加多个标签
     foreach (int tagId in m.BlogTagIds)
     {
         db.BlogPostTag.Add(
         new BlogPostTag
         {
             PostId = postId,
             BlogTagId = tagId,
             CreateTime = DateTime.Now,
             Deleted = false
         });
     }
     await db.SaveChangesAsync();
     return Created<BlogPost>(m);
 }
开发者ID:leloulight,项目名称:Magicodes.NET,代码行数:33,代码来源:BlogsPostODataController.cs


示例9: Ctor_WHEN_fullArticle_Is_Abc_THEN_Sets_FullArticle_Property_To_Abc

        public void Ctor_WHEN_fullArticle_Is_Abc_THEN_Sets_FullArticle_Property_To_Abc()
        {
            const string fullArticle = "ABC";

            var post = new BlogPost("a", "description", fullArticle, GetImageReference(), DateTime.Now, new BlogUser());
            post.FullArticle.ShouldEqual(fullArticle);
        }
开发者ID:AndyCC,项目名称:Jumbleblocks-website,代码行数:7,代码来源:BlogPostTests.cs


示例10: ImageReference

        public void BlogPostController_Edit_GIVEN_BlogPostRepository_Contains_BlogPost_With_ID_1_WHEN_blogPostId_Is_1_THEN_Returns_ViewModel_For_BlogPost()
        {
            const int BlogPostId = 1;

            var imageReference = new ImageReference(1, "/noimage.jpg");
            var author = new BlogUser { Id = 1, Forenames = "Joe", Surname = "Blogs" };

            var blogPost = new BlogPost("Test", "This is the description", "Not much in this article", imageReference, DateTime.Now, author);
            blogPost.SetProperty("Id", BlogPostId);
            blogPost.UpdateSeries(new Series { Name = "Series A" });
            blogPost.UpdateTags(new Tag[] { new Tag { Text = "Tag 1" } });

            var mockedBlogPostRepository = new Mock<IBlogPostRepository>();
            mockedBlogPostRepository.Setup(r => r.Load(BlogPostId)).Returns(blogPost);

            var controller = MockCreators.CreateBlogPostController(blogPostRepository: mockedBlogPostRepository.Object);
            var result = controller.Edit(blogPost.Id.Value) as ViewResult;

            result.ShouldNotBeNull();
            result.Model.ShouldBeInstanceOfType(typeof(CreateEditModel));

            var model = (CreateEditModel)result.Model;

            model.BlogPostId.ShouldEqual(blogPost.Id);
            model.PublishedDate.ShouldEqual(blogPost.PublishedDate);
            model.Title.ShouldEqual(blogPost.Title);
            model.Description.ShouldEqual(blogPost.Description);
            model.FullArticle.ShouldEqual(blogPost.FullArticle);
            model.ImageId.ShouldEqual(blogPost.ImageReference.Id.Value);
            model.SeriesName.ShouldEqual(blogPost.Series.Name);
        }
开发者ID:AndyCC,项目名称:Jumbleblocks-website,代码行数:31,代码来源:EditArticleTests.cs


示例11: Ctor_WHEN_author_has_value_THEN_Sets_Author_Property_To_That_Value

        public void Ctor_WHEN_author_has_value_THEN_Sets_Author_Property_To_That_Value()
        {
            var author = new BlogUser();

            var post = new BlogPost("a", "b", "c", GetImageReference(), DateTime.Now, author);
            post.Author.ShouldEqual(author);
        }
开发者ID:AndyCC,项目名称:Jumbleblocks-website,代码行数:7,代码来源:BlogPostTests.cs


示例12: Ctor_WHEN_description_Is_Abc_THEN_Sets_Description_Property_To_Abc

        public void Ctor_WHEN_description_Is_Abc_THEN_Sets_Description_Property_To_Abc()
        {
            const string description = "ABC";

            var post = new BlogPost("a", description, "fullArticle", GetImageReference(), DateTime.Now, new BlogUser());
            post.Description.ShouldEqual(description);
        }
开发者ID:AndyCC,项目名称:Jumbleblocks-website,代码行数:7,代码来源:BlogPostTests.cs


示例13: ImageReference

        public void BlogPostController_List_GIVEN_BlogPost_Has_1_Item_THEN_Returns_1_ArticleListingViewModel_With_Data_From_Post()
        {
            const int BlogPostId = 1;

            var imageReference = new ImageReference(1, "/noimage.jpg");
            var author = new BlogUser { Id = 1, Forenames = "Joe", Surname = "Blogs" };

            var blogPost = new BlogPost("Test", "This is the description", "Not much in this article", imageReference, DateTime.Now, author);
            blogPost.SetProperty("Id", BlogPostId);
            blogPost.UpdateSeries(new Series { Name = "Series A" });
            blogPost.UpdateTags(new Tag[] { new Tag { Text = "Tag 1" } });

            var mockedBlogPostRepository = new Mock<IBlogPostRepository>();

            mockedBlogPostRepository.Setup(r => r.LoadAll()).Returns(new BlogPost[] { blogPost });

            var controller = MockCreators.CreateBlogPostController(blogPostRepository: mockedBlogPostRepository.Object);
            var result = controller.List() as ViewResult;

            result.ShouldNotBeNull();
            result.Model.ShouldBeInstanceOfType(typeof(IEnumerable<BlogPostListingItemModel>));

            var viewModelForPost = ((IEnumerable<BlogPostListingItemModel>)result.Model).First();

            viewModelForPost.BlogPostId.ShouldEqual(blogPost.Id.Value);
            viewModelForPost.Title.ShouldEqual(blogPost.Title);
            viewModelForPost.PublishedDate.ShouldEqual(blogPost.PublishedDate);
            viewModelForPost.AuthorsName.ShouldEqual(blogPost.Author.FullName);
        }
开发者ID:AndyCC,项目名称:Jumbleblocks-website,代码行数:29,代码来源:ListArticleTests.cs


示例14: RenderFlatTaxaAsLink

        public string RenderFlatTaxaAsLink(BlogPost post, string taxonomyFieldName)
        {
            var baseUrl = string.Empty;
              var currentProvider = SiteMapBase.GetCurrentProvider();

              if (currentProvider == null || currentProvider != null && currentProvider.CurrentNode == null) { return string.Empty; } else {
            var currentNode = currentProvider.CurrentNode as PageSiteNode;
            if (currentNode == null) { baseUrl = currentProvider.CurrentNode.Url; } else {
              var firstPageDataNode = RouteHelper.GetFirstPageDataNode(currentNode, true);
              if (!currentNode.IsGroupPage || !(firstPageDataNode.Url != currentProvider.CurrentNode.Url)) { baseUrl = currentProvider.CurrentNode.Url; } else {
            baseUrl = firstPageDataNode.Url;
              }
            }
              }

              var tagList = "";
              var tags = post.GetValue<TrackedList<Guid>>(taxonomyFieldName);

              if (tags != null && tags.Count() > 0) {
            tagList = " | ";
            var taxManager = TaxonomyManager.GetManager();
            foreach (var tag in tags) {
              var t = taxManager.GetTaxon<FlatTaxon>(tag);
              var url = string.Format("{0}/-in-{1}/{2}/{3}", VirtualPathUtility.ToAbsolute(baseUrl), t.Taxonomy.Name, t.Taxonomy.Name, t.UrlName);
              var link = string.Format("<a class='tag' href='{0}'><span>{1}</span></a>", url, t.Title).ToString();
              tagList += link;
            }
              }

              return tagList;
        }
开发者ID:sonofabit,项目名称:BlogListFilterByTag,代码行数:31,代码来源:ListView.ascx.cs


示例15: CreateMockedBlogPostRepository

        public static Mock<IBlogPostRepository> CreateMockedBlogPostRepository(bool shouldBlogPostRepositoryAlwayReturnPost = true, int blogPostCount = 20)
        {
            //TODO: may need to allow return of specific blog post if no match
            var blogPostList = new List<BlogPost>();

            for (int i = 0; i < blogPostCount; i++)
            {
                var blogPost = new BlogPost(i.ToString(), i.ToString(), i.ToString(), new ImageReference(1, "/noimage.jpg"), DateTime.Now, new BlogUser());
                blogPost.SetProperty(p => p.Id, i);
                blogPostList.Add(blogPost);
            }

            var mockedBlogPostRepository = new Mock<IBlogPostRepository>();

            mockedBlogPostRepository.Setup(r => r.Count).Returns(blogPostCount);
            mockedBlogPostRepository.Setup(r => r.LoadAll()).Returns(blogPostList);

            mockedBlogPostRepository.Setup(r => r.LoadFrom(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>(), It.IsAny<string>()))
                .Returns<int, int, int, string>((year, month, day, title) => ReturnBlogPost(year, month, day, title, blogPostList, shouldBlogPostRepositoryAlwayReturnPost));

            mockedBlogPostRepository.Setup(r => r.GetPosts(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<IEnumerable<string>>()))
                .Returns<int, int, IEnumerable<string>>((skip, take, tags) => blogPostList.Skip(skip).Take(take));

            return mockedBlogPostRepository;
        }
开发者ID:AndyCC,项目名称:Jumbleblocks-website,代码行数:25,代码来源:MockCreators.cs


示例16: CanAddAndGetBlogPost

    public void CanAddAndGetBlogPost()
    {
      BlogPost b1 = null;

      try
      {
        // Arrange
        b1 = new BlogPost(BlogId1, "rest-assured", "REST assured", "Blah");

        // Act
        BlogPostRepository.Add(b1);
        BlogPost b2 = BlogPostRepository.Get(b1.Id);

        // Assert
        Assert.IsNotNull(b2);
        Assert.AreEqual(b1.Id, b2.Id);
        Assert.AreNotEqual(b1.Id, Guid.Empty, "Persistence layer must assign IDs");
        Assert.AreEqual(b1.BlogId, b2.BlogId);
        Assert.AreEqual(b1.Slug, b2.Slug);
        Assert.AreEqual(b1.Title, b2.Title);
        Assert.AreEqual(b1.Body, b2.Body);
        Assert.AreEqual(b1.PublishDate.ToLongDateString(), b2.PublishDate.ToLongDateString());
      }
      finally
      {
        BlogPostRepository.Remove(b1.Id);
      }
    }
开发者ID:JornWildt,项目名称:Xyperico.Blog,代码行数:28,代码来源:BlogPostRepositoryTests.cs


示例17: BlogPost

        public void Delete_GIVEN_BlogPostRepository_Has_BlogPost_With_Id_1_WHEN_blogPostId_Parameter_Is_1_And_User_Is_Logged_In_THEN_Saves_BlogPost_With_DeletedByUser_Set_To_Logged_In_User()
        {
            const int UserId = 1;
            const int BlogPostId = 1;

            BlogPost savedBlogPost = null;

            var blogPost = new BlogPost("test", "test", "test", new ImageReference(1, "/noimage.jpg"), DateTime.Now, new BlogUser());
            blogPost.SetProperty(bp => bp.Id, BlogPostId);

            var mockedBlogPostRepository = new Mock<IBlogPostRepository>();
            mockedBlogPostRepository.Setup(r => r.LoadFullArticle(BlogPostId)).Returns(blogPost);
            mockedBlogPostRepository.Setup(r => r.SaveOrUpdate(It.IsAny<BlogPost>())).Callback<BlogPost>(bp => savedBlogPost = bp);

            var mockedLookupRepository = MockCreators.CreateMockedLookupRepository();
            Mock<IJumbleblocksPrincipal> mockedPrincipal = MockCreators.CreateMockedPrincipalAndAddBlogUserToLookUp(mockedLookupRepository, UserId);

            var controller = MockCreators.CreateBlogPostController(blogPostRepository: mockedBlogPostRepository.Object, lookupRepository: mockedLookupRepository.Object);
            controller.SetPrincipal(mockedPrincipal.Object);

            controller.Delete(BlogPostId);

            savedBlogPost.ShouldNotBeNull();
            savedBlogPost.DeletedByUser.Id.ShouldEqual(UserId);
        }
开发者ID:AndyCC,项目名称:Jumbleblocks-website,代码行数:25,代码来源:DeleteArticleTests.cs


示例18: Create

        public static void Create(BlogPost m_BlogPost)
        {
            SqlConnection conn = DB.DbConnect();
            conn.Open();

            string queryString = "SELECT IDENT_CURRENT('CMS_BlogPosts')";
            SqlCommand getBlogId = new SqlCommand(queryString, conn);
            int m_BlogId = (int)(decimal)getBlogId.ExecuteScalar();
            conn.Close();

            if (m_BlogId == 1)
            {
                conn.Open();
                queryString = "SELECT COUNT(*) FROM CMS_BlogPosts";
                SqlCommand getPageCount = new SqlCommand(queryString, conn);
                int pageCount = (int)getPageCount.ExecuteScalar();

                if (m_BlogId == pageCount)
                {
                    m_BlogId = pageCount + 1;
                }
                conn.Close();
            }
            else
            {
                m_BlogId++;
            }

            conn.Open();

            queryString = "INSERT INTO CMS_BlogPosts(blogId, title, publishDate, expirationDate, contentGroup, [content], comments, pageWorkFlowState, lockedBy, lastModifiedBy, lastModifiedDate, newsImageId, newsImageName, author, introText) VALUES(@blogId, @title, @publishDate, @expirationDate, @contentGroup, @content, @comments, 1, @lockedBy, @lastModifiedBy, @lastModifiedDate, @newsImageId, @newsImageName, @author, @introText)";
            SqlCommand insertBlogPost = new SqlCommand(queryString, conn);
            insertBlogPost.Parameters.AddWithValue("blogId", m_BlogId);
            insertBlogPost.Parameters.AddWithValue("title", m_BlogPost.Title);
            insertBlogPost.Parameters.AddWithValue("publishDate", m_BlogPost.PublishDate.ToString());
            insertBlogPost.Parameters.AddWithValue("expirationDate", m_BlogPost.PublishDate.ToString());
            insertBlogPost.Parameters.AddWithValue("contentGroup", m_BlogPost.ContentGroup);
            insertBlogPost.Parameters.AddWithValue("content", m_BlogPost.Content);
            insertBlogPost.Parameters.AddWithValue("comments", m_BlogPost.Comments);
            insertBlogPost.Parameters.AddWithValue("lockedBy", HttpContext.Current.Session["uid"]);
            insertBlogPost.Parameters.AddWithValue("lastModifiedBy", HttpContext.Current.Session["uid"]);
            insertBlogPost.Parameters.AddWithValue("lastModifiedDate", DateTime.Now);
            insertBlogPost.Parameters.AddWithValue("newsImageId", m_BlogPost.NewsImageId);
            insertBlogPost.Parameters.AddWithValue("newsImageName", m_BlogPost.NewsImageName ?? "");
            insertBlogPost.Parameters.AddWithValue("author", m_BlogPost.Author ?? "");
            insertBlogPost.Parameters.AddWithValue("introText", m_BlogPost.IntroText);
            insertBlogPost.ExecuteNonQuery();

            foreach (int catId in m_BlogPost.Categories)
            {
                queryString = "INSERT INTO CMS_BlogPostsToCategories(blogPostId, categoryId) VALUES(@blogId, @catId)";
                SqlCommand insertCat = new SqlCommand(queryString, conn);
                insertCat.Parameters.AddWithValue("blogId", m_BlogId);
                insertCat.Parameters.AddWithValue("catId", catId);
                insertCat.ExecuteNonQuery();
            }

            conn.Close();
        }
开发者ID:pragmatikprogramming,项目名称:CMS,代码行数:59,代码来源:DBBlogPost.cs


示例19: updatePost

        private static void updatePost( BlogPost post ) {
            User owner = User.findById( post.OwnerId );
            int appId = post.AppId;

            LayoutCacher.Update( owner, appId );
            HomeCacher.Update( owner, appId );
            MainCacher.Update( appId );
        }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:8,代码来源:BlogCacheManager.cs


示例20: Edit

        public ActionResult Edit(string id, BlogPost blogPost)
        {
            blogPost.LastModified = DateTime.Now;
              RavenSession.Store(blogPost);
              RavenSession.SaveChanges();

              return RedirectToAction("Index");
        }
开发者ID:haiku80,项目名称:raventest,代码行数:8,代码来源:BlogPostsController.cs



注:本文中的BlogPost类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# BlogRollItem类代码示例发布时间:2022-05-24
下一篇:
C# BlogMLBlog类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap