Ejemplo n.º 1
0
        public ActionResult Edit(Page page)
        {
            if (ModelState.IsValid)
            {
                this.pageRepository.InsertOrUpdate(page);
                this.pageRepository.Save();
                return RedirectToAction("Index");
            }

            return this.View();
        }
Ejemplo n.º 2
0
 public void InsertOrUpdate(Page page)
 {
     if (page.PageId == default(int))
     {
         // New entity
         this.context.Pages.Add(page);
     }
     else
     {
         // Existing entity
         this.context.Entry(page).State = EntityState.Modified;
     }
 }