Exemple #1
0
        public async Task <string> ReceiveScore(Guid examId, Guid proctorId,
                                                double gradePercent, QuestionId questionId, CancellationToken cancellationToken)
        {
            var command = new ReceiveScoreCommand(examId, proctorId, gradePercent, questionId);
            var result  = await _commandBus.PublishAsync(command, cancellationToken);

            return(result.ScoreId);
        }
Exemple #2
0
        public async Task <IActionResult> ExamScoreReceived([FromBody] ExamReceiveScoreRequest request, CancellationToken cancellationToken)
        {
            var command = new ReceiveScoreCommand(request.ExamId, request.ProctorId,
                                                  request.GradePercent, request.QuestionId, request.AnswerId);

            var result = await _commandBus.PublishAsync(command, cancellationToken);

            return(result.IsSuccess ? Ok() : StatusCode(500));
        }