Esempio n. 1
0
 public IHttpActionResult Waiting()
 {
     try
     {
         return(Ok(_baseTestService.Search(_ => _.Status != BaseTestStatus.Approved,
                                           _ => _.Approver,
                                           _ => _.Course,
                                           _ => _.BaseTestContents).ToList()
                   .Select(_ => new
         {
             Approver = _.Approver.FullName,
             _.NumberOfQuestion,
             _.StartTime,
             _.EndTime,
             _.Duration,
             _.ExamCode,
             Course = _.Course.Name,
             questions = _.BaseTestContents.Select(__ => new {
                 __.Content,
                 Options = JsonConvert.DeserializeObject <GetOptionVM[]>(__.Options),
                 __.Level
             })
         })));
     }
     catch (Exception ex)
     {
         _loggingService.Write(ex);
         return(InternalServerError(ex));
     }
 }
Esempio n. 2
0
 public IHttpActionResult GetBySemester(string semesterCode)
 {
     try
     {
         var result = _baseTestService.Search(_ => _.Exam.SemesterCode == semesterCode,
                                              _ => _.Exam, _ => _.Course)
                      .Select(_ => new ExamVM
         {
             Id         = _.Id,
             CourseCode = _.CourseCode,
             CourseName = _.Course.Name,
             ExamCode   = _.ExamCode,
             TestDay    = _.Exam.StartDate
         });
         return(Ok(result));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }