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