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