Example #1
0
        public FillUp AddFillUpNoNextFillUp(int odometer, double liters)
        {
            FillUp f = new FillUp(odometer, liters);

            //this.FillUps.Add(f);
            FillUps.Add(f);
            return(f);
        }
Example #2
0
        public FillUp AddFillUp(int odometer, double liters, bool isFull = true)
        {
            var fillUpItem = new FillUp(odometer, liters, isFull);

            if (FillUps.Count > 0)
            {
                FillUps.Last().NextFileUp = fillUpItem;
            }
            FillUps.Add(fillUpItem);
            return(fillUpItem);
        }
Example #3
0
        public FillUp AddFillUp(int odometer, double liters)
        {
            FillUp f = new FillUp(odometer, liters);

            if (FillUps?.Count > 0)
            {
                FillUps.LastOrDefault().NextFillUp = f;
            }
            FillUps.Add(f);
            return(f);
        }
Example #4
0
        public FillUp AddFillUp(int odometer, double liters)
        {
            //throw new NotImplementedException();
            FillUp f = new FillUp(odometer, liters);

            if (FillUps.Count > 0)
            {
                FillUps[FillUps.Count - 1].NextFillUp = f;
            }

            FillUps.Add(f);

            return(f);
        }
Example #5
0
        // Method

        public FillUp AddFillUp(int odometer, double liters)
        {
            FillUp f    = new FillUp(odometer, liters);
            FillUp last = FillUps.LastOrDefault();

            if (last != null)
            {
                last.NextFillUp = f;
            }

            FillUps.Add(f);

            return(f);
        }
Example #6
0
        public FillUp AddFillUp(int odometer, double liters)
        {
            FillUp f = new Models.FillUp();

            f.Odometer = odometer;
            f.Liters   = liters;

            if (FillUps.Count > 0)
            {
                FillUps[FillUps.Count - 1].NextFillUp = f;
            }

            FillUps.Add(f);

            return(f);
        }
Example #7
0
        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);
        }
Example #8
0
        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);
        }
Example #9
0
        public FillUp AddFillUp(int odometer, double liters, bool isFull = true)
        {
            var f = new FillUp();

            f.Odometer   = odometer;
            f.Liters     = liters;
            f.IsFull     = isFull;
            f.NextFillUp = null;

            if (FillUps.Count > 0)
            {
                FillUps.Last().NextFillUp = f;
            }

            FillUps.Add(f);
            return(f);
        }
Example #10
0
        public FillUp AddFillUp(int odometer, double liters, bool isFull = true)
        {
            FillUp f = new FillUp(odometer, liters, isFull);

            if (FillUps.Count > 0)
            {
                FillUps.LastOrDefault().NextFillUp = f;
            }
            if (FillUps.Count == 0 || (FillUps.Count > 0 && FillUps.LastOrDefault().Odometer < f.Odometer))
            {
                FillUps.Add(f);
            }
            else
            {
                throw new InvalidOperationException();
            }

            return(f);
        }
Example #11
0
        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);
        }
Example #12
0
        public FillUp AddFillUp(int odometer, double lister)
        {
            if (odometer <= 0)
            {
                throw new Exception();
            }
            if (lister <= 0)
            {
                throw new Exception();
            }
            var fillUp = new FillUp(odometer, lister);

            if (FillUps.Count > 0)
            {
                var last = FillUps.Last();
                last.Next = fillUp;
            }

            FillUps.Add(fillUp);
            return(fillUp);
        }