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