예제 #1
0
        public ActionResult Create([Bind(Include = "ServiceID,Name,ServiceText")] Service service)
        {
            if (ModelState.IsValid)
            {
                db.Services.Add(service);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(service));
        }
예제 #2
0
        public ActionResult Create([Bind(Include = "FlightID,FlightClassID,From,Destination" +
                                                   ",CompanyName,Departure,Price,DepartureTime,Capacity")] Flight flight)
        {
            if (ModelState.IsValid)
            {
                db.Flights.Add(flight);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.FlightClassID = new SelectList(db.FlightClasses, "FlightClassID",
                                                   "FlightClassKind", flight.FlightClassID);
            return(View(flight));
        }
예제 #3
0
 public void Save()
 {
     db.SaveChanges();
 }