public double?GetKml() { if (FillUps.Count <= 1) { return(null); } var kml = FillUps.Where(it => it.Next != null).Sum(it => it.Kml); //Console.WriteLine(kml); return(60); }
public FillUp AddFillUp(int odoMeter, double liters) { FillUp f = new FillUp(odoMeter, liters); //var prevFillUp = FillUps.LastOrDefault(); var prevFillUp = FillUps.Where(x => x.NextFillUp == null).FirstOrDefault(); if (prevFillUp != null) { prevFillUp.NextFillUp = f; } FillUps.Add(f); return(f); }