示例#1
0
        private static StaticPage GenerateProductionStaticPage()
        {
            var page = new StaticPage
            {
                PageTitle   = "Welcome to BlogNC",
                FullContent = "<h3>Welcome</h3><br /><p>Welcome to BlogNC, an open source blogging" +
                              " platform coded in ASP .NET Core MVC. I wanted to create a wordpress alternative " +
                              "for anyone who knows how to program in C#, or for anyone who is a little annoyed at using " +
                              "php all the time :)</p>" +
                              "<p>This project is still very much under development. There are many features that should be " +
                              "and will be added as time moves along. I appreciate your interest, and do hope that you find " +
                              "it serves (most of) your needs. Because this project is open source, I do invite you to " +
                              "contribute on <a href=\"https://github.com/nfisher23/BlogNC\">The BlogNC GitHub page</a>. We" +
                              " appreciate any feedback you give us in advance!</p>" +
                              "<p>To get started with BlogNC, review the aforementioned GitHub page for the latest instructions." +
                              " We hope you have a wonderful time!</p>" +
                              "<p>-Nick Fisher, BlogNC founder and voted most-handsome BlogNC developer for three weeks running</p>",
                InMainNav       = true,
                MainNavPriority = 0,
                InFooter        = true,
                FooterPriority  = 0,
                IsHomePage      = true
            };

            return(page);
        }
示例#2
0
        public bool SaveStaticPage(StaticPage page)
        {
            if (page.StaticPageId == 0)
            {
                var count = AppDbContext.StaticPages
                            .Count(sp => sp.UrlTitle.ToLower() == page.UrlTitle.ToLower());

                if (count == 0)
                {
                    AppDbContext.StaticPages.Add(page);
                    AppDbContext.SaveChanges();
                    return(true);
                }
                return(false);
            }
            else
            {
                var pageToUpdate = GetStaticPageById(page.StaticPageId);
                if (pageToUpdate != null)
                {
                    pageToUpdate.UpdatePage(page);
                    AppDbContext.SaveChanges();
                    return(true);
                }
                return(false);
            }
        }
示例#3
0
 public void UpdatePage(StaticPage page)
 {
     StaticPageId    = page.StaticPageId;
     PageTitle       = page.PageTitle;
     FullContent     = page.FullContent;
     InMainNav       = page.InMainNav;
     InFooter        = page.InFooter;
     MainNavPriority = page.MainNavPriority;
     FooterPriority  = page.FooterPriority;
     IsHomePage      = page.IsHomePage;
 }
示例#4
0
        public void UpdateMetadata(StaticPage page)
        {
            var pageToUpdate = GetStaticPageById(page.StaticPageId);

            if (pageToUpdate != null)
            {
                page.FullContent = pageToUpdate.FullContent;
                pageToUpdate.UpdatePage(page);
                AppDbContext.SaveChanges();
            }
        }
示例#5
0
 public void DeleteStaticPage(StaticPage page)
 {
     AppDbContext.StaticPages.Remove(page);
     AppDbContext.SaveChanges();
 }