예제 #1
0
        public async Task <IActionResult> CheckTest([FromBody] TestModel testModel)
        {
            var response = await _testService.CheckTest(testModel, Convert.ToInt32(Request.Cookies["userId"]));

            if (response.Code <= HttpStatusCode.PermanentRedirect)
            {
                return(Json(response.Data));
            }
            else
            {
                return(BadRequest());
            }
        }
예제 #2
0
        public IActionResult Result(int TestId, List <string> results)
        {
            var test = testService.Get(TestId);

            ResultTestViewModel resultTest = new ResultTestViewModel();

            try
            {
                resultTest.Test   = testService.CheckTest(test.TestId, results, User);
                resultTest.Course = courseService.CheckCourse(test.CourseId, User);
            }
            catch (ValidationException ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(View(nameof(Courses)));
            }

            return(View(resultTest));
        }
예제 #3
0
        public IHttpActionResult CheckTest(int courseId, int chapterId, List <SubmitTestViewModel> submitTests)
        {
            ResponseDataDTO <int> response = new ResponseDataDTO <int>();

            try
            {
                response.Code    = HttpCode.OK;
                response.Message = MessageResponse.SUCCESS;
                response.Data    = _testService.CheckTest(courseId, chapterId, submitTests);
            }
            catch (Exception ex)
            {
                response.Code    = HttpCode.INTERNAL_SERVER_ERROR;
                response.Message = MessageResponse.FAIL;
                response.Data    = 0;

                Console.WriteLine(ex.ToString());
            }

            return(Ok(response));
        }
예제 #4
0
 public ActionResult PostCheck(TestForCheack mod)
 {
     return(Json(testService.CheckTest(mod)));
 }
예제 #5
0
 public object PostCheck(TestForCheack mod)
 {
     return(testservice.CheckTest(mod));
 }