Пример #1
0
        //Obtain the destination city and code configured in the system
        public List<Destination> getAllDestinations()
        {
            List<Destination> lstDestination=null;
            var destinationQuery = from f in flightContext.Destinations select f;
            if(destinationQuery == null) return null;
            if (destinationQuery.Count() == 0) return null;

            //update the list with the destinations
            Destination dest;
            lstDestination = new List<Destination>();
            foreach (var destination in destinationQuery)
            {
                dest = new Destination();
                dest.CityCode = destination.CityCode;
                dest.City = destination.City;
                lstDestination.Add(dest);
            }
            return lstDestination;
        }
 /// <summary>
 /// Create a new Destination object.
 /// </summary>
 /// <param name="cityCode">Initial value of the CityCode property.</param>
 /// <param name="city">Initial value of the City property.</param>
 public static Destination CreateDestination(global::System.String cityCode, global::System.String city)
 {
     Destination destination = new Destination();
     destination.CityCode = cityCode;
     destination.City = city;
     return destination;
 }
Пример #3
0
 public int saveDestination(Destination d)
 {
     try
     {
         flightContext.AddToDestinations(d);
         return flightContext.SaveChanges();
     }
     catch (Exception e)
     {
         throw new FlightException("Error saving the Destination record... make sure the CityCode is unique");
     }
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Destinations EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToDestinations(Destination destination)
 {
     base.AddObject("Destinations", destination);
 }