public async Task <IActionResult> RenderPreviewExam(Guid?logId, Guid?currentInstructorId) { if (logId == null || logId == Guid.Empty) { this.ToastError(L["Can not process your review exam"]); return(Redirect("/")); } var res = await _ExamLogService.GetAsync(logId.Value); var model = new ExamRenderViewModel(); if (res.Success) { #region Kiểm tra xem có phải là GVHD xem lại hay không var isInstructorReview = false; if (currentInstructorId != null && currentInstructorId.Value != Guid.Empty && currentInstructorId.Value == CurrentUser.Id) { isInstructorReview = await ExamCatInstructorRepository.AnyAsync(x => x.UserId == CurrentUser.Id.Value && x.ExamCategoryId == res.Data.ExamCategoryId); } ViewBag.IsInstructorReview = isInstructorReview; #endregion model.ExamContent = JsonConvert.DeserializeObject <ExamForRenderDTO>(res.Data.RawExamRendered); model.ExamLogId = res.Data.Id; model = await ProcessParams(model); var creatorId = await _ExamLogService.GetCreatorId(logId.Value); if (creatorId != null && creatorId != Guid.Empty) { model.ExamUser = (await _AppUserService.GetAsync(creatorId.Value)).Data; } ViewBag.Answers = JsonConvert.DeserializeObject <List <QAPairDTO> >(res.Data.UserAnswers); ViewBag.Scores = res.Data.ExamScores.ToString("0.0"); ViewBag.TimeInMinutes = res.Data.ExamTimeInMinutes; ViewBag.IsDoneScore = res.Data.IsDoneScore; ViewBag.ExamLogId = res.Data.Id; ViewBag.InstructorComment = res.Data.InstructorComments; ViewBag.RenderType = res.Data.RenderExamType; return(View(AppTheme.ExamPreview, model)); } else { this.ToastError(L["Can not process your previous exam"]); return(Redirect("/")); } }