示例#1
0
        public IHttpActionResult PutTrip(int id, Trip trip)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != trip.TripID)
            {
                return(BadRequest());
            }

            db.Entry(trip).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TripExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#2
0
 public ActionResult Edit([Bind(Include = "BusID,Capacity,Company,Class")] Bus bus)
 {
     if (ModelState.IsValid)
     {
         db.Entry(bus).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(bus));
 }
示例#3
0
 public ActionResult Edit([Bind(Include = "ClientID,Name,Surname,Birthdate,Email")] Client client)
 {
     if (ModelState.IsValid)
     {
         db.Entry(client).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(client));
 }
示例#4
0
 public ActionResult Edit([Bind(Include = "CityID,CityName")] City city)
 {
     if (ModelState.IsValid)
     {
         db.Entry(city).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(city));
 }
示例#5
0
 public ActionResult Edit([Bind(Include = "SeatID,BusID")] Seat seat)
 {
     if (ModelState.IsValid)
     {
         db.Entry(seat).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(seat));
 }
示例#6
0
 public ActionResult Edit([Bind(Include = "ID,Name,Brand,Color,Seats")] Bus bus)
 {
     if (ModelState.IsValid)
     {
         db.Entry(bus).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(bus));
 }
示例#7
0
 public ActionResult Edit([Bind(Include = "BookingID,ClientID,SeatID,BusID,TripID")] Booking booking)
 {
     if (ModelState.IsValid)
     {
         db.Entry(booking).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ClientID = new SelectList(db.Clients, "ClientID", "Name", booking.ClientID);
     ViewBag.SeatID   = new SelectList(db.Seats, "SeatID", "SeatID", booking.SeatID);
     ViewBag.TripID   = new SelectList(db.Trips, "TripID", "TripID", booking.TripID);
     return(View(booking));
 }
示例#8
0
 public ActionResult Edit([Bind(Include = "TripID,BusID,OriginID,DestinationID,Price,DateTimeTrip")] Trip trip)
 {
     if (ModelState.IsValid)
     {
         db.Entry(trip).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.BusID         = new SelectList(db.Buses, "BusID", "Company", trip.BusID);
     ViewBag.DestinationID = new SelectList(db.Cities, "CityID", "CityName", trip.DestinationID);
     ViewBag.OriginID      = new SelectList(db.Cities, "CityID", "CityName", trip.OriginID);
     return(View(trip));
 }
示例#9
0
 public ActionResult BusEdit(Bus bus)
 {
     db.Entry(bus).State = EntityState.Modified;
     db.SaveChanges();
     return(RedirectToAction("BusesList"));
 }