예제 #1
0
        public ActionResult Create(Location location)
        {
            if (ModelState.IsValid)
            {
                db.Locations.Add(location);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.ValidationStateID = new SelectList(db.ValidationStates, "ValidationStateID", "Description", location.ValidationStateID);
            return View(location);
        }
예제 #2
0
 public ActionResult Edit(Location location)
 {
     if (ModelState.IsValid)
     {
         db.Entry(location).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.ValidationStateID = new SelectList(db.ValidationStates, "ValidationStateID", "Description", location.ValidationStateID);
     return View(location);
 }