public void UpdatePlant(PlantRecord currentPlant) { var plants = GetAllPlants().ToList(); for (var i = 0; i < plants.Count; i++) { if (!plants[i].Equals(currentPlant)) { continue; } if (currentPlant.ShouldBeDeleted is true) { plants.RemoveAt(i); } else { plants[i] = currentPlant; } break; } plantTable.WriteAllData(plants); }
public void AddNewPlant(PlantRecord newPlant) { plantTable.AddNewRecord(newPlant); }
public void DeletePlant(PlantRecord currentPlant) { currentPlant.ShouldBeDeleted = true; UpdatePlant(currentPlant); }