Beispiel #1
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            Trip trip = TripDB.FindBy(x => x.TripID == id).Single();

            TripDB.Remove(trip);
            TripDB.Commit();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
 public ActionResult Edit(Trip trip)
 {
     if (ModelState.IsValid)
     {
         TripDB.Attach(trip);
         TripDB.Commit();
         return(RedirectToAction("Index"));
     }
     return(View(trip));
 }
Beispiel #3
0
        public ActionResult Create()
        {
            User trip_leader = get_current_user();
            Trip new_trip    = new Trip(trip_leader.UserID);

            TripDB.Add(new_trip);
            TripDB.Commit();

            trip_leader.trips.Add(new_trip);
            UserDB.Attach(trip_leader);
            UserDB.Commit();

            return(RedirectToAction("Details", new { id = new_trip.TripID }));
        }
Beispiel #4
0
        public ActionResult Create(Trip trip, Guid userID)
        {
            if (ModelState.IsValid)
            {
                User trip_leader = UserDB.FindBy(x => x.UserID == userID).Single();

                trip.TripID = Guid.NewGuid();
                TripDB.Add(trip);

                trip.trip_leader = trip_leader;
                trip_leader.trips.Add(trip);

                UserDB.Attach(trip_leader);


                UserDB.Commit();
                TripDB.Commit();
                return(RedirectToAction("Index"));
            }

            return(View(trip));
        }