Ejemplo n.º 1
0
        public ActionResult Edit(Trip trip)
        {
            if (ModelState.IsValid) {
                tripRepository.InsertOrUpdate(trip);
                tripRepository.Save();
                return RedirectToAction("Index");
            } else {
				return View();
			}
        }
Ejemplo n.º 2
0
 public void InsertOrUpdate(Trip trip)
 {
     if (trip.Id == default(int)) {
         // New entity
         context.Trips.Add(trip);
     } else {
         // Existing entity
         context.Entry(trip).State = EntityState.Modified;
     }
 }