public bool AddHybridToList(Hybrid hybrid) { int startingCount = _listofHybrids.Count; _listofHybrids.Add(hybrid); bool wasAdded = (_listofHybrids.Count > startingCount) ? true : false; return(wasAdded); }
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); } }
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); } }