Пример #1
0
        public void RegisterTravel(string company, string startCity, DateTime startTime, string stop, string endCity, DateTime endTime, int ticketPrice)
        {
            using (var db = new TransportSystemDB()) {
                Travel travel = new Travel() {
                    Company = company, StartCity = startCity , StartTime = startTime, EndCity = endCity, EndTime = endTime, TicketPrice = ticketPrice
                };

                Stop intermediaryStop = new Stop() { stop1 = stop, id = travel.id };
                db.Stops.AddObject(intermediaryStop);
                db.Travels.AddObject(travel);
                db.SaveChanges();
            }
        }
 /// <summary>
 /// Create a new Stop object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="stop1">Initial value of the stop1 property.</param>
 public static Stop CreateStop(global::System.Int32 id, global::System.String stop1)
 {
     Stop stop = new Stop();
     stop.id = id;
     stop.stop1 = stop1;
     return stop;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Stops EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToStops(Stop stop)
 {
     base.AddObject("Stops", stop);
 }