Example #1
0
        private static void AddExsistingTrait(Person selectedPerson, TraitRepository traitRepository, PersonRepository personRepository, GenotypeRepository genotypeRepository, RealRandomNumberGenerator rng, GeneticCounsellorDbContext context)
        {
            Console.Clear();
            Console.WriteLine("Already exsisting Traits:");
            int num = 0;

            foreach (var t in traitRepository.ListTraits())
            {
                Console.WriteLine(num + ") " + t);
                num++;
            }
            Console.WriteLine("Select a trait from the list:");
            int   traitIndex  = Convert.ToInt32(Console.ReadLine());
            var   allTraits   = traitRepository.ListTraits();
            Trait chosenTrait = allTraits[traitIndex];

            selectedPerson.AddTraitToPerson(chosenTrait);
            Console.WriteLine("Select which genotype to add to person:");
            chosenTrait.GenerateGenotypesForATrait(genotypeRepository);
            AddExsistingGenotype(traitRepository, selectedPerson, genotypeRepository, personRepository, rng, context);
            context.SaveChanges();
            PersonScreen(traitRepository, selectedPerson, personRepository, genotypeRepository, rng, context);
        }