Exemplo n.º 1
0
        public void RemoveStaticPage(StaticPage pageToRemove)
        {
            var repo = StaticFactory.CreateStaticPageRepository();

            repo.DeleteTagStaticBridgeTable(pageToRemove);
            repo.RemoveStaticPage(pageToRemove);
        }
Exemplo n.º 2
0
        public List <StaticPage> GetAllPages()
        {
            var repo = StaticFactory.CreateStaticPageRepository();
            var page = repo.GetAllPages();

            return(page);
        }
Exemplo n.º 3
0
        public void addStaticPageCheckTheDelete()
        {
            var repo = StaticFactory.CreateStaticPageRepository();

            StaticPage page = new StaticPage();

            page.Name        = "Anime";
            page.Body        = "Anime stuff";
            page.Category    = Category.Anime;
            page.Approved    = Approved.Yes;
            page.DateCreated = DateTime.Today;

            repo.AddStaticPage(page);
            List <StaticPage> pages = repo.GetAllPages();
            StaticPage        check = pages.Last();

            Assert.AreEqual("Anime", check.Name);
            Assert.AreEqual("Anime stuff", check.Body);
            //Assert.AreEqual(Anime, check.Category);
            //Assert.AreEqual("Yes", check.Approved);

            repo.RemoveStaticPage(page);

            Assert.IsNull(repo.GetPageByID(page.Id));
        }
Exemplo n.º 4
0
        public void AddStaticPage(StaticPage pageToAdd)
        {
            var repo = StaticFactory.CreateStaticPageRepository();

            repo.AddStaticPage(pageToAdd);

            foreach (var tag in pageToAdd.Tag)
            {
                InsertTagStaticBridgeTable(tag.Id, pageToAdd.Id);
            }
        }
Exemplo n.º 5
0
        public void EditStaticPage(StaticPage pageToEdit)
        {
            var repo = StaticFactory.CreateStaticPageRepository();

            repo.DeleteTagStaticBridgeTable(pageToEdit);

            foreach (var tag in pageToEdit.Tag)
            {
                repo.InsertTagStaticBridgeTable(tag.Id, pageToEdit.Id);
            }

            repo.EditStaticPage(pageToEdit);
        }
Exemplo n.º 6
0
        public StaticPage GetPostByID(int id)
        {
            StaticResponse response = new StaticResponse();
            var            repo     = StaticFactory.CreateStaticPageRepository();
            var            page     = repo.GetPageByID(id);

            if (page != null)
            {
                response.Success    = true;
                response.Message    = "It worked!";
                response.StaticPage = page;
            }
            else
            {
                response.Success = false;
                response.Message = "Post not found!";
            }
            return(page);
        }
Exemplo n.º 7
0
        public void InsertTagStaticBridgeTable(int tagId, int pageId)
        {
            var repo = StaticFactory.CreateStaticPageRepository();

            repo.InsertTagStaticBridgeTable(tagId, pageId);
        }