예제 #1
0
        // Update: each vehicle info
        public bool UpdateExistingElectric(string originalMake, ElectricClass newMake)
        {
            //find the content
            ElectricClass oldMake = GetElectricByMake(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);
            }
        }
예제 #2
0
        // Delete: delete a vehicle by make name
        public bool RemoveElectricFromList(string make)
        {
            ElectricClass electric = GetElectricByMake(make);

            if (make == null)
            {
                return(false);
            }

            int initialElectric = _listOfElectrics.Count;

            _listOfElectrics.Remove(electric);

            if (initialElectric > _listOfElectrics.Count)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #3
0
 // Create: creating new vehicle to add
 public void AddElectricToList(ElectricClass make)
 {
     _listOfElectrics.Add(make);
 }