public async Task Start(StudentTestSession studentTestSession, Guid variantId) { var queryParams = new TestSessionVariantsQueryParameters { Id = variantId, TestSessionId = studentTestSession.TestSessionId, IsReadOnly = false, }; var testVariant = await _unitOfWork.GetSingleOrDefault(queryParams); if (testVariant == null) { throw new CodedException(ErrorCode.InvalidVariantName); } if (studentTestSession.TestSession.StudentTestDuration.HasValue) { studentTestSession.ShouldEndAt = _dateTimeProvider.UtcNow.Add(studentTestSession.TestSession.StudentTestDuration.Value); } studentTestSession.TestVariantId = variantId; studentTestSession.Questions = GenerateQuestions(testVariant); await _unitOfWork.Update(studentTestSession); }
public Task <IQueryable <Lookup> > Handle( GetStudentTestSessionVariantsRequest request, CancellationToken cancellationToken) { var queryParameters = new TestSessionVariantsQueryParameters { StudentTestSessionId = request.StudentTestSessionId, StudentId = _executionContextService.GetCurrentUserId(), }; return(Task.FromResult(_queryProvider.Queryable(queryParameters) .Select(e => new Lookup(e.Name, e.Id.ToString())))); }