public ActionResult Edit([Bind(Include = "Id,FlightId,UserId")] Booking booking)
 {
     if (ModelState.IsValid)
     {
         db.Entry(booking).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.UserId   = new SelectList(db.AspNetUsers, "Id", "Email", booking.UserId);
     ViewBag.FlightId = new SelectList(db.Flights, "Id", "AirplaneId", booking.FlightId);
     return(View(booking));
 }
Exemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "Id,AirplaneId,From,To")] Flight flight)
 {
     if (ModelState.IsValid)
     {
         db.Entry(flight).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AirplaneId = new SelectList(db.Airplanes, "Id", "AirlineId", flight.AirplaneId);
     ViewBag.From       = new SelectList(db.Airports, "Id", "Code", flight.From);
     ViewBag.To         = new SelectList(db.Airports, "Id", "Code", flight.To);
     return(View(flight));
 }
        public ActionResult ChangeLanguage(string id)
        {
            Session["Language"] = Language.LanguageDictionary[id];

            // Als de gebruiker aangemeld is:  Wijzig ook de gebruikers-taal!
            if (User.Identity.IsAuthenticated)
            {
                DB_Examen_P5_BramEntities db = new DB_Examen_P5_BramEntities();
                AspNetUser user = db.AspNetUsers.First(u => u.UserName == User.Identity.Name);
                user.LanguageId      = id;
                db.Entry(user).State = EntityState.Modified;
                db.SaveChanges();
            }

            return(Redirect(Session["LastUrl"].ToString()));
        }