Esempio n. 1
0
        public ActionResult Edit(int id)
        {
            WaitoPage pages_db = new WaitoEntities().WaitoPages.Where( p => p.PageId == id).FirstOrDefault();

            Page page = new Page()
            {
                PageId = pages_db.PageId,
                PageName = pages_db.PageName,
                PageContent = pages_db.PageContent
            };
            return View(page);
        }
Esempio n. 2
0
        public ActionResult Edit(Page page)
        {
            if (ModelState.IsValid)
            {
                using (WaitoEntities entities = new WaitoEntities())
                {
                    WaitoPage pages_db = entities.WaitoPages.Where(p => p.PageId == page.PageId).FirstOrDefault();

                    pages_db.PageName = page.PageName;
                    pages_db.PageContent = page.PageContent;

                    entities.SaveChanges();
                }

                return RedirectToAction("Index");
            }

            return View();
        }
Esempio n. 3
0
        public ActionResult Create(Page page)
        {
            if (ModelState.IsValid)
            {
                using (WaitoEntities entities = new WaitoEntities())
                {
                    WaitoPage pages_db = new WaitoPage()
                    {
                        PageName = page.PageName,
                        PageContent = page.PageContent
                    };

                    entities.WaitoPages.Add(pages_db);
                    entities.SaveChanges();
                }

                return RedirectToAction("Index");
            }

            return View();
        }