Example #1
0
        public async Task <IActionResult> EvaluateCodeSnippet([FromRoute] int attendeeId, [FromRoute] bool runOnlyDefault, [FromBody] TestAnswerAC testAnswer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            if (testAnswer.Code == null || testAnswer.Code.Source == "")
            {
                return(BadRequest());
            }
            var codeResponse = testAnswer.Code.Input == null
                ? await _testConductRepository.ExecuteCodeSnippetAsync(attendeeId, runOnlyDefault, testAnswer)
                : await _testConductRepository.ExecuteCustomInputAsync(attendeeId, testAnswer);

            return(Ok(codeResponse));
        }