예제 #1
0
        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);
        }
예제 #2
0
 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);
 }