Example #1
0
        public async Task <Guid> HandleAsync(CreateUserCommand command)
        {
            var user = _mapper.Map <User>(command);

            user.Role = UserRole.Student;

            await _repository.Add(user);

            await _commandStoreService.PushAsync(command);

            return(user.Id);
        }
Example #2
0
        public async Task <Guid> HandleAsync(CreateCourseCommand command)
        {
            var course = new Course {
                Name        = command.Name,
                Code        = command.Code.ToUpper(),
                Description = command.Description,
            };

            await _repository.Add(course);

            await _commandStoreService.PushAsync(command);

            return(course.Id);
        }
Example #3
0
        public async Task <Guid> HandleAsync(CreateAssignmentCommand command)
        {
            var assignment = new Assignment {
                Title       = command.Title,
                Description = command.Description,
                PublishAt   = command.PublishAt,
                DeadlineAt  = command.DeadlineAt,
                CourseId    = command.CourseId.GetValueOrDefault(),
            };

            await _repository.Add(assignment);

            await _commandStoreService.PushAsync(command);

            return(assignment.Id);
        }