コード例 #1
0
        public ActionResult Create(DivingSpotModel divingspotmodel, int ID)
        {
            if (ModelState.IsValid)
            {
                divingspotmodel.DivingAreaID = ID;
                db.DivingSpots.Add(divingspotmodel);
                db.SaveChanges();
                return RedirectToAction("Index", "DivingSpot");
            }

            return View(divingspotmodel);
        }
コード例 #2
0
 public ActionResult Edit(DivingSpotModel divingspotmodel, int id)
 {
     if (ModelState.IsValid)
     {
         divingspotmodel.DivingAreaID = id;
         db.Entry(divingspotmodel).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(divingspotmodel);
 }