public ActionResult Edit(Post post) { if (ModelState.IsValid) { db.Entry(post).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } //ViewBag.BlogId = new SelectList(db.Blogs, "Id", "Title", post.BlogId); return View(post); }
public ActionResult Create(Post post) { if (ModelState.IsValid) { db.Posts.Add(post); db.SaveChanges(); return RedirectToAction("Index"); } //ViewBag.BlogId = new SelectList(db.Blogs, "Id", "Title", post.BlogId); return View(post); }