Exemplo n.º 1
0
        public ActionResult Create(BlogPost blogpost)
        {
            if (ModelState.IsValid)
            {
                blogpost.PostedOn = DateTime.Now;
                db.BlogPosts.Add(blogpost);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(blogpost);
        }
Exemplo n.º 2
0
 public ActionResult Edit(BlogPost blogpost)
 {
     if (ModelState.IsValid)
     {
         db.Entry(blogpost).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(blogpost);
 }