Beispiel #1
0
        private void GetAll_Click(object sender, EventArgs e)
        {
            List <Animal> animals = AnimalDbHelper.GetTable();
            string        text    = animals.Aggregate("", (current, animal) => current + string.Format("Name: {0} Type: {1} Food Intake: {2}\n", animal.Name, animal.Type, animal.Food_Intake));

            Animals.Text = text;
        }
        private void Search_Click(object sender, EventArgs e)
        {
            List <Animal> animals = AnimalDbHelper.GetTable();
            Animal        animal  = animals.First(x => x.Room == (byte)Room.Value && x.Name == name.Text &&
                                                  x.Type == Type.Text);

            if (animal != null)
            {
                new EditAnimalMenu(animal).Show();
                Close();
            }
            else
            {
                MessageBox.Show("No animal found!");
                return;
            }
        }