public async Task HandleAsync(CreateAnimalCommand command)
        {
            var allSpecies = await _speciesRepository.GetAllSpecies();

            var species = allSpecies.FirstOrDefault(x => x.Name == command.Name);
            var animal  = new Animal(command.Name, command.Age, command.Gender, species);
            await _repository.AddAnimal(animal);
        }
Ejemplo n.º 2
0
 public async Task <IEnumerable <Species> > HandleAsync(GetAllSpeciesQuery command)
 {
     return(await _repository.GetAllSpecies());
 }