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); }
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); }
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); }