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()); } }
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)); }
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)); }
public ActionResult PostCheck(TestForCheack mod) { return(Json(testService.CheckTest(mod))); }
public object PostCheck(TestForCheack mod) { return(testservice.CheckTest(mod)); }