public ActionResult Edit(TravelType traveltype) { if (ModelState.IsValid) { db.TravelTypes.Attach(traveltype); db.ObjectStateManager.ChangeObjectState(traveltype, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } return View(traveltype); }
public ActionResult Create(TravelType traveltype) { if (ModelState.IsValid) { db.TravelTypes.AddObject(traveltype); db.SaveChanges(); return RedirectToAction("Index"); } return View(traveltype); }
/// <summary> /// Deprecated Method for adding a new object to the TravelTypes EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToTravelTypes(TravelType travelType) { base.AddObject("TravelTypes", travelType); }
/// <summary> /// Create a new TravelType object. /// </summary> /// <param name="id">Initial value of the id property.</param> /// <param name="name">Initial value of the name property.</param> /// <param name="price">Initial value of the price property.</param> /// <param name="available_days">Initial value of the available_days property.</param> public static TravelType CreateTravelType(global::System.Int32 id, global::System.String name, global::System.Decimal price, global::System.String available_days) { TravelType travelType = new TravelType(); travelType.id = id; travelType.name = name; travelType.price = price; travelType.available_days = available_days; return travelType; }