public FillUp AddFillUp(int odometer, double liters) { var f = new FillUp() { Odometer = odometer, Liters = liters }; if (FillUps.Any()) { FillUps.OrderBy(x => x.Odometer).Last().NextFillUp = f; } FillUps.Add(f); return(f); }
public FillUp AddFillUp(int odometer, double liters) { var f = new FillUp() { Odometer = odometer, Liters = liters }; //if (FillUps.Count > 0) { // FillUps[FillUps.Count - 1].NextFillUp = f; //} if (FillUps.Any <FillUp>()) { FillUps.OrderBy(x => x.Odometer).Last().NextFillUp = f; } FillUps.Add(f); return(f); }