public ActionResult Create(Article article) { if (ModelState.IsValid) { db.Articles.Add(article); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.TagId = new SelectList(db.Tags, "TagId", "title", article.TagId); return View(article); }
public ActionResult Edit(Article article) { if (ModelState.IsValid) { db.Entry(article).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(article); }