public ActionResult Edit(DestinationDisp dDisp) { if (ModelState.IsValid) { Destination destination = db.Destinations.Find(dDisp.DestinationID); destination.CopyData(dDisp); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.RegionID = new SelectList(db.Regions, "RegionID", "Name", dDisp.RegionID); return(View(dDisp)); }
public ActionResult Create([Bind(Include = "DestinationID,Name,RegionID,NatureRating,NightlifeRating,ShoppingRating")] DestinationDisp dDisp) { if (ModelState.IsValid) { Destination destination = new Destination(); destination.CopyData(dDisp); db.Destinations.Add(destination); db.SaveChanges(); return(RedirectToAction("Index")); } dDisp.Region = (from r in db.Regions where r.RegionID == dDisp.RegionID select r).First(); ViewBag.RegionID = new SelectList(db.Regions, "RegionID", "Name", dDisp.RegionID); return(View(dDisp)); }