Example #1
0
        public void AddRating(BarData barData, int rating)
        {
            var allBars = BarFileReader.GetAllBarData();

            if (barData.Ratings == null)
            {
                barData.Ratings = new List <int>();
            }
            barData.Ratings.Add(rating);
            // Update local copy of list
            BarsData.Find(x => x == barData).Ratings = barData.Ratings;

            var foundBar = allBars.FindIndex(x => x.Title == barData.Title);

            if (foundBar != -1)
            {
                allBars[foundBar].Ratings = barData.Ratings;
            }
            else
            {
                allBars.Add(barData);
            }

            BarFileWriter.SaveData(allBars);
        }
Example #2
0
 public void AddBars(List <BarData> barsList)
 {
     foreach (var bar in barsList)
     {
         if (BarsData.Count(x => x.Title == bar.Title) == 0)
         {
             BarsData.Add(bar);
         }
     }
     BarFileWriter.SaveData(BarsData);
 }