예제 #1
0
        public ActionResult Create(DivingSiteModel divingsitemodel, int ID)
        {
            if (ModelState.IsValid)
            {
                divingsitemodel.DivingAreaID = ID;
                db.DivingSites.Add(divingsitemodel);
                db.SaveChanges();
                return RedirectToAction("Index", "DivingSite");
            }

            return View(divingsitemodel);
        }
예제 #2
0
 public ActionResult Edit(DivingSiteModel divingsitemodel, int id)
 {
     if (ModelState.IsValid)
     {
         divingsitemodel.DivingAreaID = id;
         db.Entry(divingsitemodel).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(divingsitemodel);
 }