public ActionResult Create(Organization organization) { if (ModelState.IsValid) { db.OrganizationSet.Add(organization); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.DistrictId = new SelectList(db.PlaceSet, "Id", "Name", organization.DistrictId); ViewBag.CountyId = new SelectList(db.PlaceSet, "Id", "Name", organization.CountyId); return View(organization); }
public ActionResult Edit(Organization organization) { if (ModelState.IsValid) { db.Entry(organization).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.DistrictId = new SelectList(db.PlaceSet, "Id", "Name", organization.DistrictId); ViewBag.CountyId = new SelectList(db.PlaceSet, "Id", "Name", organization.CountyId); return View(organization); }