Exemplo n.º 1
0
        public bool AddHybridToList(Hybrid hybrid)
        {
            int startingCount = _listofHybrids.Count;

            _listofHybrids.Add(hybrid);
            bool wasAdded = (_listofHybrids.Count > startingCount) ? true : false;

            return(wasAdded);
        }
Exemplo n.º 2
0
        public bool UpdateExistingHybrids(string originalModel, Hybrid newHybrid)
        {
            Hybrid oldHybrid = GetHybridByModel(originalModel);

            if (oldHybrid != null)
            {
                oldHybrid.Make           = newHybrid.Make;
                oldHybrid.Model          = newHybrid.Model;
                oldHybrid.FuelEfficiency = newHybrid.FuelEfficiency;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        public bool RemoveHybridFromList(string model)
        {
            Hybrid hybrid = GetHybridByModel(model);

            if (hybrid == null)
            {
                return(false);
            }
            int initialCount = _listofHybrids.Count();

            _listofHybrids.Remove(hybrid);
            if (initialCount > _listofHybrids.Count)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }