コード例 #1
0
 public ActionResult Edit([Bind(Include = "LocationID,Name,Latitude,Longitude")] Location location)
 {
     if (ModelState.IsValid)
     {
         db.Entry(location).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(location));
 }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "TreasureID,Name,TreasureImage,LocationID")] Treasure image)
 {
     if (ModelState.IsValid)
     {
         db.Entry(image).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.LocationID = new SelectList(db.Locations, "LocationID", "Name", image.LocationID);
     return(View(image));
 }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "QuestionID,QuestionValue,Answer,LocationID,NextLocationID")] Question question)
 {
     if (ModelState.IsValid)
     {
         db.Entry(question).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.LocationID     = new SelectList(db.Locations, "LocationID", "Name", question.LocationID);
     ViewBag.NextLocationID = new SelectList(db.Locations, "NextLocationID", "Name", question.NextLocationID);
     return(View(question));
 }