예제 #1
0
        public static void InitDefaultData(School school, Subjects subjects)
        {
            subjects = school.GetSubjects();
            subjects.AddSubject("History");
            subjects.AddSubject("Math");
            subjects.AddSubject("Phisics");
            subjects.AddSubject("Biology");
            subjects.AddSubject("Sport");
            subjects.AddSubject("Computers");

            school.AddChild("Boris", 12);

            school[1].AddSubject(subjects[1], 154);
            school[1].AddSubject(subjects[2], 150);
            school[1].AddSubject(subjects[3], 234);

            school.AddChild("Mike", 14);

            school[2].AddSubject(subjects[6], 132);
            school[2].AddSubject(subjects[5], 245);
            school[2].AddSubject(subjects[4], 172);
        }
예제 #2
0
        public async Task <Child> Handle(AddChildCommand command)
        {
            School school = await schoolRepository.GetSchool(command.SchoolId);

            Parent parent = await schoolRepository.GetParent(command.SchoolId, command.ParentId);

            Child child = Child.Create(
                Name.Create(command.Name),
                BirthDate.Create(command.BirthDate),
                Custody.Create(CustodyEnum.ChildConfirmedWithFamily));

            school.AddChild(parent, child);

            await bus.Publish(school.GetEvents(), command.Header);

            return(child);
        }
예제 #3
0
 private void AddChild()
 {
     try
     {
         Console.Write("Имя школьника: ");
         var name = Console.ReadLine();
         Console.Write("Возраст школьника: ");
         var age = Int32.Parse(Console.ReadLine());
         school.AddChild(name, age);
     }
     catch (Exception ex)
     {
         Console.WriteLine("Некоректнный возраст");
         Console.ReadKey();
         Console.Clear();
         AddChild();
     }
     Console.WriteLine("школьник добавлен !!!");
     Console.ReadKey();
     Menu();
 }