Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        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));
        }