private async Task <CreateClassSubjectItemDto> CreateClassSubjectAsync(CreateCourseClassItemDto createCourseClassDto)
        {
            var instructorDto = await SendWithValidationAsync(new CreateInstructorItemCommand()
            {
                FirstName = "first",
                LastName  = "last",
                HireDate  = DateTime.UtcNow.DateTimeWithoutMilisecond(),
            }, new CreateInstructorItemCommandValidator());

            var createSubjectItemCommand = new CreateSubjectItemCommand()
            {
                Title          = "Subject1",
                InstructorList = new List <Guid> {
                    instructorDto.Id
                },
            };
            var createSubjectItemDto = await SendWithValidationAsync(createSubjectItemCommand,
                                                                     new CreateSubjectItemCommandValidator());

            var getSubjectItemDto = await SendAsync(new GetSubjectItemQuery()
            {
                Id = createSubjectItemDto.Id
            });

            var createClassSubjectCommand = new CreateClassSubjectItemCommand()
            {
                Title               = $"{createCourseClassDto.Id.ToString()}-subject1",
                CourseClassId       = createCourseClassDto.Id,
                SubjectAssignmentId = getSubjectItemDto.SubjectAssignmentList.First(),
            };

            var createClassSubjectDto = await SendWithValidationAsync(createClassSubjectCommand, new CreateClassSubjectItemCommandValidator());

            return(createClassSubjectDto);
        }
Ejemplo n.º 2
0
        private async Task <CreateClassSubjectItemDto> CreateClassSubjectAsync(CreateSubjectDto subjectDto, CreateCourseClassItemDto courseClassItemDto)
        {
            var getSubjectItemDto = await SendAsync(new GetSubjectItemQuery()
            {
                Id = subjectDto.Id
            });

            var createClassSubjectCommand = new CreateClassSubjectItemCommand()
            {
                Title               = $"{courseClassItemDto.Id}-subject1",
                CourseClassId       = courseClassItemDto.Id,
                SubjectAssignmentId = getSubjectItemDto.SubjectAssignmentList.First(),
            };

            var createClassSubjectDto = await SendWithValidationAsync(createClassSubjectCommand, new CreateClassSubjectItemCommandValidator());

            return(createClassSubjectDto);
        }