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

            return View(blog);
        }