private static void AddAnAnimal()
        {
            Console.WriteLine("What's the animal called?");
            var name = Console.ReadLine();
            Console.WriteLine("How many legs does it have?");
            var numberOfLegs = Int32.Parse(Console.ReadLine());

            var animal = new Animal(1, name, numberOfLegs);
            _repository.Create(animal);
        }
        public void Create(Animal animal)
        {
            if (animal == null) throw new ArgumentNullException(nameof(animal));

            var query = "INSERT INTO Animals (Name, NumberOfLegs) VALUES (@Name, @NumberOfLegs)";
            var connection = CreateOpenConnection();

            using (var command = new SqlCommand(query, connection))
            {
                command.Parameters.AddWithValue("@Name", animal.Name);
                command.Parameters.AddWithValue("@NumberOfLegs", animal.NumberOfLegs);
                command.ExecuteNonQuery();
            }
        }
 public void Create(Animal animal)
 {
     _dataAccess.Create(animal);
 }
 private static void WriteAnimal(Animal animal)
 {
     Console.WriteLine($"Animal {animal.Id} is a {animal.Name} with {animal.NumberOfLegs} legs.");
 }