Beispiel #1
0
        /// <summary>
        /// Add a new sportType to the webservice and reload ws sports list
        /// Or Add it to the local sportType list
        /// save the list localy
        /// </summary>
        /// <param name="sport">new sportType to add in SportTypes</param>
        public static async void SaveSport(SportType sport)
        {
            try
            {
                if (SportTypes == null)
                {
                    await LoadSports();
                }

                SportTypes = await WSConsumer.AddSport(sport);
            }
            catch (Exception e)
            {
                DependencyService.Get <IMessage>().longtime("ERR: " + e.Message);
                if (SportTypes == null)
                {
                    SportTypes = new List <SportType>();
                }

                SportTypes.Add(sport);
            }
            SaveList(SportTypes, sportFile);
        }