public ActionResult Delete(int id)
        {
            PageRepo reap  = new PageRepo();
            var      model = reap.GetPageById(id);

            return(View(model));
        }
        public ActionResult ListPages()
        {
            PageRepo reap  = new PageRepo();
            var      model = reap.GetAllPages();

            return(View(model));
        }
        public ActionResult DeletePage(Page webpage)
        {
            PageRepo reap = new PageRepo();

            reap.Delete(webpage.Id);
            return(RedirectToAction("Index"));
        }
        public ActionResult EditPage(Page webpage)
        {
            if (ModelState.IsValid)
            {
                PageRepo pr = new PageRepo();

                pr.Edit(webpage);
                return(RedirectToAction("Index"));
            }
            return(View(webpage));
        }
示例#5
0
        public ActionResult Index()
        {
            PageRepo pg    = new PageRepo();
            PostRepo pr    = new PostRepo();
            var      model = new DisplayPagePostViewModel();

            model.Posts = pr.GetAllPosts();
            model.Pages = pg.GetAllPages();

            return(View(model));
        }
        public ActionResult CreatePage(Page webpage)
        {
            if (ModelState.IsValid)
            {
                PageRepo pr = new PageRepo();

                var fabpost = new Page();
                fabpost.Title    = webpage.Title;
                fabpost.PostText = webpage.PostText;

                pr.Add(fabpost);
                return(RedirectToAction("Index"));
            }
            return(View(webpage));
        }