public ActionResult Edit(TahDoItem tahdoitem) { if (ModelState.IsValid) { db.Entry(tahdoitem).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.TahDoListId = new SelectList(db.TahDoLists, "Id", "Title", tahdoitem.TahDoListId); return View(tahdoitem); }
public ActionResult Create(TahDoItem tahdoitem) { if (ModelState.IsValid) { db.TahDoItems.Add(tahdoitem); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.TahDoListId = new SelectList(db.TahDoLists, "Id", "Title", tahdoitem.TahDoListId); return View(tahdoitem); }