示例#1
0
        public ActionResult Create([Bind(Include = "Id,Name")] BusCompany busCompany)
        {
            if (ModelState.IsValid)
            {
                db.BusCompanies.Add(busCompany);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(busCompany));
        }
        public ActionResult Create([Bind(Include = "Id,From,To,Price,Distance")] Destination destination)
        {
            if (ModelState.IsValid)
            {
                db.Destinations.Add(destination);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(destination));
        }