예제 #1
0
 public ActionResult Edit(BlogPost blogpost)
 {
     if (ModelState.IsValid)
     {
         db.Entry(blogpost).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(blogpost);
 }
예제 #2
0
        public ActionResult Create(BlogPost blogpost)
        {
            if (ModelState.IsValid)
            {
                db.BlogPosts.Add(blogpost);
                db.SaveChanges();
                return RedirectToAction("Index");  
            }

            return View(blogpost);
        }