示例#1
0
        public static async Task <int> SaveTour(Tour tour)
        {
            try
            {
                Task <float> tmp = WebRequester.ReturnDistance(tour.Source, tour.Destination);
                await        tmp;
                tour.Distance = tmp.Result;

                int rCode = Database.InsertTour(tour);
                if (rCode == 0)
                {
                    FetchImage(tour.Name, tour.Source, tour.Destination);
                }
                else
                {
                    return(-1);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception Encountered:{0}", e.Message);
            }

            return(1);
        }