Exemplo n.º 1
0
        public ActionResult Create([Bind(Include = "Id,name,Plan")] Trip trip)
        {
            if (ModelState.IsValid)
            {
                db.Trip.Add(trip);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(trip));
        }
Exemplo n.º 2
0
        public ActionResult Create([Bind(Include = "Id,login,password,role,name")] Users users)
        {
            if (ModelState.IsValid)
            {
                db.Users.Add(users);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(users));
        }
Exemplo n.º 3
0
        public ActionResult Create([Bind(Include = "Id,name,State")] Buss buss)
        {
            if (ModelState.IsValid)
            {
                db.Buss.Add(buss);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(buss));
        }
Exemplo n.º 4
0
        public ActionResult Create([Bind(Include = "Id,Day,Id_trip,Id_driver,Id_worker,Id_buss")] TripPlan tripPlan)
        {
            if (ModelState.IsValid)
            {
                db.TripPlan.Add(tripPlan);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Id_buss   = new SelectList(db.Buss, "Id", "name", tripPlan.Id_buss);
            ViewBag.Id_trip   = new SelectList(db.Trip, "Id", "name", tripPlan.Id_trip);
            ViewBag.Id_driver = new SelectList(db.Users, "Id", "login", tripPlan.Id_driver);
            ViewBag.Id_worker = new SelectList(db.Users, "Id", "login", tripPlan.Id_worker);
            return(View(tripPlan));
        }