Esempio n. 1
0
 public void AddStop(string tripName, string userName, Stop newStop)
 {
     var trip = GetTripByName(tripName, userName);
     newStop.Order = (trip.Stops.Any() ? trip.Stops.Max(s => s.Order) + 1 : 1);
     trip.Stops.Add(newStop);
     _context.Add(newStop);
 }
Esempio n. 2
0
 public void AddStop(string tripName, string username, Stop newStop)
 {
   var theTrip = GetTripByName(tripName, username);
   newStop.Order = theTrip.Stops.Max(s => s.Order) + 1;
   theTrip.Stops.Add(newStop);
   _context.Stops.Add(newStop);
 }
Esempio n. 3
0
 public void AddStop(string tripName, string user, Stop stop)
 {
     var trip = GetTripByName(tripName, user);
     trip.Stops.Add(stop);
     stop.Order = trip.Stops.Max(s => s.Order) + 1;
     this.context.Stops.Add(stop);
 }
Esempio n. 4
0
        public void AddStop(string tripName, Stop newStop)
        {
            var theTrip = GetTripByName(tripName);

            newStop.Order = theTrip.Stops.Any() ? theTrip.Stops.Max(s => s.Order) + 1 : 1;
            //theTrip.Stops.Add(newStop);
            _context.Trips.Single(s => s.Name == tripName).Stops.Add(newStop);
        }
Esempio n. 5
0
 public void AddStop(string tripName, string userName, Stop newStop)
 {
     var theTrip = GetTripByName(tripName, userName);
     // here we can also set some default properties if we need them
     newStop.Order = theTrip.Stops.Max(s => s.Order) + 1;
     // we are adding the newStop to the Stops list
     theTrip.Stops.Add(newStop);
     _context.Stops.Add(newStop);
 }
        public void AddStop(string tripName, string name, Stop newStop)
        {
            var theTrip = GetTripByName(tripName, name);
            var a = theTrip.Stops.Count;
            if (a.Equals(0)) {
                newStop.Order = 1;
            }else { newStop.Order = theTrip.Stops.Max(s => s.Order) + 1; }

            theTrip.Stops.Add(newStop);
            _context.Stops.Add(newStop);
        }
Esempio n. 7
0
 public static StopViewModel Create(this IModelFactory factory, Stop model)
 {
     var stop = new StopViewModel
     {
         Id = model.Id,
         Name = model.Name,
         Arrival = model.Arrival,
         Longitude = model.Longitude,
         Latitude = model.Latitude
     };
     return stop;
 }
Esempio n. 8
0
 public void AddStop(string tripName, string userName,Stop newStop)
 {
     var theTrip = GetTripByName(tripName, userName);
     if (theTrip.Stops.Any())
     {
         newStop.Order = theTrip.Stops.Max(s => s.Order) + 1;
     }
     else
     {
         newStop.Order = 1;
     }
     theTrip.Stops.Add(newStop);
     _context.Stops.Add(newStop);
 }
Esempio n. 9
0
 public void AddStop(string tripName, string userName, Stop stop)
 {
     var theTrip = GetTripByName(tripName, userName);
     if (theTrip.Stops.Count() == 0)
     {
         stop.Order = 1;
     }
     else
     {
         stop.Order = theTrip.Stops.Max(s => s.Order) + 1;
     }
     theTrip.Stops.Add(stop);
     _context.Stops.Add(stop);
 }
Esempio n. 10
0
        public void AddStop(string tripName, Stop newStop, string userName)
        {
            var theTrip = GetTripByName(tripName, userName);

            int orderMax = 0;
            if (theTrip.Stops.Any())
            {
                orderMax = theTrip.Stops.Max(x => x.Order);
            }

            newStop.Order = orderMax + 1;
            theTrip.Stops.Add(newStop);

            context.Stops.Add(newStop);
        }
Esempio n. 11
0
        public void AddStop(string tripName, Stop newStop, string name)
        {
            
            var Trip = GetTripByName(tripName, name);

            if (Trip.Stops.Count > 0)
            {
                newStop.Order = Trip.Stops.Max(s => s.Order) + 1;
            }
            else
            {
                newStop.Order = 0;
            }
            

            Trip.Stops.Add(newStop);
            
            _context.Stops.Add(newStop);
        }
 public void SaveStop(string tripName, string userName, Stop stop)
 {
     var theTrip = GetTripByName(tripName, userName);
     stop.Order = theTrip.Stops.Max(x => x.Order) + 1;
     theTrip.Stops.Add(stop);
     _context.Stops.Add(stop);
 }
 public void AddStop(string tripName, string userName, Stop newStop)
 {
 }