コード例 #1
0
        public void Seed()
        {
            if (BlogPosts.Any())
            {
                return;
            }

            Authors.Add(new Author {
                AppUserName = "******",
                Email       = "*****@*****.**",
                DisplayName = "Administrator",
                Avatar      = "data/admin/avatar.png",
                Bio         = "<p>Something about <b>administrator</b>, maybe HTML or markdown formatted text goes here.</p><p>Should be customizable and editable from user profile.</p>",
                IsAdmin     = true,
                Created     = DateTime.UtcNow.AddDays(-120)
            });

            Authors.Add(new Author {
                AppUserName = "******",
                Email       = "*****@*****.**",
                DisplayName = "Demo user",
                Bio         = "Short description about this user and blog.",
                Created     = DateTime.UtcNow.AddDays(-110)
            });

            SaveChanges();

            var adminId = Authors.Single(a => a.AppUserName == "admin").Id;
            var demoId  = Authors.Single(a => a.AppUserName == "demo").Id;

            BlogPosts.Add(new BlogPost
            {
                Title       = "Welcome to Blogifier!",
                Slug        = "welcome-to-blogifier!",
                Description = SeedData.FeaturedDesc,
                Content     = SeedData.PostWhatIs,
                Categories  = "welcome,blog",
                AuthorId    = adminId,
                Cover       = "data/admin/cover-blog.png",
                PostViews   = 5,
                Rating      = 4.5,
                IsFeatured  = true,
                Published   = DateTime.UtcNow.AddDays(-100)
            });

            BlogPosts.Add(new BlogPost
            {
                Title       = "Blogifier Features",
                Slug        = "blogifier-features",
                Description = "List of the main features supported by Blogifier, includes user management, content management, plugin system, markdown editor, simple search and others. This is not the full list and work in progress.",
                Content     = SeedData.PostFeatures,
                Categories  = "blog",
                AuthorId    = adminId,
                Cover       = "data/admin/cover-globe.png",
                PostViews   = 15,
                Rating      = 4.0,
                Published   = DateTime.UtcNow.AddDays(-55)
            });

            BlogPosts.Add(new BlogPost
            {
                Title       = "Demo post",
                Slug        = "demo-post",
                Description = "This demo site is a sandbox to test Blogifier features. It runs in-memory and does not save any data, so you can try everything without making any mess. Have fun!",
                Content     = SeedData.PostDemo,
                AuthorId    = demoId,
                Cover       = "data/demo/demo-cover.jpg",
                PostViews   = 25,
                Rating      = 3.5,
                Published   = DateTime.UtcNow.AddDays(-10)
            });

            SaveChanges();
        }
コード例 #2
0
ファイル: Editor.cs プロジェクト: hit-subscribe/ElDorado
 public bool HasCompletedWorkInMonth(int year, int month)
 {
     return(BlogPosts.Any(bp => bp.DraftCompleteDate.MatchesYearAndMonth(year, month)));
 }
コード例 #3
0
 public bool HasPostsDue(DateTime dueDate)
 {
     return(BlogPosts != null && BlogPosts.Any(bp => bp.DraftDate.GetValueOrDefault() == dueDate.Date));
 }
コード例 #4
0
 public bool HasCompletedWorkInMonth(int year, int month)
 {
     return(BlogPosts.Any(bp => bp.DraftCompleteDate.MatchesYearAndMonth(year, month)) ||
            PostRefreshes.Any(pr => pr.SubmittedDate.MatchesYearAndMonth(year, month)));
 }
コード例 #5
0
 public bool SlugIsInUse(string slug)
 {
     return(BlogPosts.Any(i => i.Slug.ToLower() == slug.ToLower()));
 }