Esempio n. 1
0
 public ActionResult Edit(Blog blog)
 {
     if (ModelState.IsValid)
     {
         ctx.Entry(blog).State = EntityState.Modified;
         ctx.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(blog);
 }
Esempio n. 2
0
        public ActionResult Create(Blog blog)
        {
            if (ModelState.IsValid)
            {
                ctx.Posts.Add(blog);
                ctx.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(blog);
        }