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); }
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); } }
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; }
public void UpdateMetadata(StaticPage page) { var pageToUpdate = GetStaticPageById(page.StaticPageId); if (pageToUpdate != null) { page.FullContent = pageToUpdate.FullContent; pageToUpdate.UpdatePage(page); AppDbContext.SaveChanges(); } }
public void DeleteStaticPage(StaticPage page) { AppDbContext.StaticPages.Remove(page); AppDbContext.SaveChanges(); }