public ActionResult Create(ODA oda) { if (ModelState.IsValid) { db.ODA.Add(oda); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.ODAKAPASITEID = new SelectList(db.ODAKAPASITE, "ID", "ADI", oda.ODAKAPASITEID); ViewBag.ODATIPID = new SelectList(db.ODATIPI, "ID", "ADI", oda.ODATIPID); return View(oda); }
public ActionResult Edit(ODA oda) { if (ModelState.IsValid) { db.Entry(oda).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.ODAKAPASITEID = new SelectList(db.ODAKAPASITE, "ID", "ADI", oda.ODAKAPASITEID); ViewBag.ODATIPID = new SelectList(db.ODATIPI, "ID", "ADI", oda.ODATIPID); return View(oda); }