Ejemplo n.º 1
0
 public ActionResult CreatePage(StaticPage page)
 {
     var manager = new AdminManager();
     var pageCount = manager.GetAllPages().Count;
     manager.AddPage(page);
     page.PageDate = DateTime.Now;
     if (pageCount == 0)
     {
         page.PageID = 1;
     }
     else
         page.PageID = manager.GetAllPages().Count + 1;
     return RedirectToAction("Index", "Home");
 }
Ejemplo n.º 2
0
        public void CanAddStaticPage()
        {
            var manager = new AdminManager();
            var pageCount = manager.GetAllPages().Count;
            var toAdd = new StaticPage();

            toAdd.PageID = pageCount + 1;
            toAdd.PageTitle = "Test title";
            toAdd.PageBody = "test static page";
            toAdd.PageDate = DateTime.Now;

            manager.AddPage(toAdd);

            var secondCount = manager.GetAllPages().Count;
            Assert.AreEqual(pageCount +1, secondCount);
        }
Ejemplo n.º 3
0
 // GET: StaticPage
 public ActionResult PageIndex()
 {
     var manager = new AdminManager();
     var pages = manager.GetAllPages();
     return View(pages);
 }
Ejemplo n.º 4
0
        public void CanDeleteStaticPage()
        {
            var manager = new AdminManager();
            var pageCount = manager.GetAllPages().Count;
            var page = manager.GetPageByID(pageCount);

            manager.DeletePage(page);
            var secondCount = manager.GetAllPages().Count;

            Assert.AreEqual(pageCount -1, secondCount);
        }
Ejemplo n.º 5
0
        public void CancEditStaticPage()
        {
            var manager = new AdminManager();
            var toEdit = manager.GetPageByID(manager.GetAllPages().Count);
            toEdit.PageTitle = "Edited Static Page Title";

            manager.EditPage(toEdit);
            var toCheck = manager.GetPageByID(manager.GetAllPages().Count);

            Assert.AreEqual(toEdit.PageTitle, toCheck.PageTitle);
        }
Ejemplo n.º 6
0
 public IEnumerable<StaticPage> Get()
 {
     var repo = new AdminManager();
     return repo.GetAllPages();
 }