// Update: each vehicle info public bool UpdateExistingHybrid(string originalMake, HybridClass newMake) { //find the content HybridClass oldMake = GetHybridByMake(originalMake); //update the content if (oldMake != null) { oldMake.Make = newMake.Make; oldMake.Model = newMake.Model; oldMake.Year = newMake.Year; oldMake.Price = newMake.Price; oldMake.Miles = newMake.Miles; return(true); } else { return(false); } }
// Delete: delete a vehicle by make name public bool RemoveHybridFromList(string make) { HybridClass hybrid = GetHybridByMake(make); if (make == null) { return(false); } int initialHybrid = _listOfHybrids.Count; _listOfHybrids.Remove(hybrid); if (initialHybrid > _listOfHybrids.Count) { return(true); } else { return(false); } }
// Create: creating new vehicle to add public void AddHybridToList(HybridClass make) { _listOfHybrids.Add(make); }