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); }
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); }