public void AddOneMonth() { var r = new Random(); if (SalesmenSeries[0].Values.Count >= _months.Count()) { return; } foreach (var salesman in SalesmenSeries.Where(x => x.Title != "Average Series")) { salesman.Values.Add(new SalesData { ItemsSold = r.Next(5, 30), Rentability = r.NextDouble() * .2, ItemsAverageSellPrice = 5000 }); } var averageSeries = SalesmenSeries.FirstOrDefault(x => x.Title == "Average Series"); if (averageSeries != null) { averageSeries.Values.Add(new AverageSalesData { AverageItemsSold = r.Next(20, 25) }); } }
public void InstertAMiddleVal() { var r = new Random(); foreach (var salesman in SalesmenSeries.Where(x => x.Title != "Average Series")) { if (salesman.Values.Count > 2) { salesman.Values.Insert(2, new SalesData { ItemsSold = r.Next(5, 30), Rentability = r.NextDouble() * .2, ItemsAverageSellPrice = 5000m + ((decimal)r.NextDouble() * 1000) }); } } var averageSeries = SalesmenSeries.FirstOrDefault(x => x.Title == "Average Series"); if (averageSeries != null) { averageSeries.Values.Insert(2, new AverageSalesData { AverageItemsSold = r.Next(20, 25) }); } }