コード例 #1
0
        public IActionResult CreateExamSuite([FromBody] ExamSuiteDetail request)
        {
            //HACK: use SubjectId instead of ConsiderationStatus
            var _subject = repoQ.GetInActiveSubject(request.ConsiderationStatus);
            //var qid = string.Concat(qcode, "TH");
            var qid    = Guid.NewGuid().ToString();
            var qsuite = new TheS.ExamBank.DataFormats.QuestionSuite()
            {
                _id         = qid,
                Code        = request.TitleCode,
                Title       = request.TitleName,
                SubjectName = _subject.SubjectName,
                Description = "Description",
                SubjectId   = request.ConsiderationStatus,
                SubjectCode = _subject.SubjectCode,
                Level       = 1,
                LayoutCode  = "LayoutCode",
                Questions   = Enumerable.Empty <TheS.ExamBank.DataFormats.Question>(),
            };

            repoQ.InsertQuestionSuite(qsuite);

            var examSuiteCount = repoQ.GetAllQuestionSuiteBySubjectId(_subject._id).Count();

            repoQ.UpdateQuestionCount(_subject._id, _subject.QuestionCount, examSuiteCount);

            return(Ok(new { Message = $"Created!", ExamSuiteId = qid }));
        }
コード例 #2
0
        public IActionResult UpdateExamSuite([FromBody] ExamSuiteDetail request)
        {
            var qsuite = repoQ.GetQuestionSuite(request.id);

            repoQ.UpdateQuestionSuiteCodeAndName(request.id, request.TitleCode, request.TitleName);

            return(Ok(new { Message = $"Updated!", ExamSuiteId = request.id }));
        }