예제 #1
0
        public ActionResult Create([Bind(Include = "CarID,CarVin,CarMark,CarModel,CarType,CarPrice,CarRegisterDate")] Car car)
        {
            if (ModelState.IsValid)
            {
                db.Cars.Add(car);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(car));
        }
        public ActionResult Create([Bind(Include = "LocationCode,Name,Description,Latitude,Longitude")] Location location)
        {
            if (ModelState.IsValid)
            {
                db.Locations.Add(location);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(location));
        }
        public ActionResult Create([Bind(Include = "BookingID,BookingTime,RentingStart,RentingEnd,PickUP_LocationCode,Contact_PhoneNumber")] Booking booking)
        {
            if (ModelState.IsValid)
            {
                db.Bookings.Add(booking);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.PickUP_LocationCode = new SelectList(db.Locations, "LocationCode", "Name", booking.PickUP_LocationCode);
            return(View(booking));
        }
예제 #4
0
        public ActionResult Create([Bind(Include = "BookingBookingID,OlCarID,ReturnDate,ReturnStatus")] Order_Line order_Line)
        {
            if (ModelState.IsValid)
            {
                db.Order_Line.Add(order_Line);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.BookingBookingID = new SelectList(db.Bookings, "BookingID", "Contact_PhoneNumber", order_Line.BookingBookingID);
            ViewBag.OlCarID          = new SelectList(db.Cars, "CarID", "CarVin", order_Line.OlCarID);
            return(View(order_Line));
        }