예제 #1
0
        public void RemovePlant(int id)
        {
            var plantForRemoval = Plants.FirstOrDefault(p => p.Id == id);

            //var removalName = Plants.Find(p => )
            Plants.Remove(plantForRemoval);
            SaveChanges();
            Console.WriteLine($"I removed the {plantForRemoval.Species} and gave it to the groundhog to eat.");
        }
예제 #2
0
        public void WaterPlant(int id)
        {
            // Water
            //    This will update the plant's LastWateredDate to the Current Time. The user will select the plant by Id
            var plantToWater = Plants.FirstOrDefault(p => p.Id == id);

            plantToWater.LastWateredDate = DateTime.Now;
            SaveChanges();
            Console.WriteLine($"I watered the {plantToWater.Species}. It is no longer thirsty.");
        }