Exemplo n.º 1
0
        public ActionResult ReEdit(int subjectId)
        {
            SubjectBll        bll     = new SubjectBll();
            Yw_SubjectProcess process = bll.GetNextProcess(
                subjectId,
                CurrentUserID,
                SubjectStatusEnum.编辑中,
                SubjectActionEnum.重新编辑);

            bll.ReEdit(process);

            return(Json(new SuccessJsonResponse()));
        }
Exemplo n.º 2
0
        protected int SaveSubject(QuestionInputModel subject)
        {
            SubjectBll bll = new SubjectBll();

            //题目信息
            Yw_Subject          subjectEntity     = null;
            Action <Yw_Subject> saveSubjectMethod =
                SubjectFetcher.Fetch(subject, bll, CurrentUserID, out subjectEntity);

            //题目内容
            Yw_SubjectContent          content           = null;
            ContentFetcher             fetcher           = GetContentFetcher();
            Action <Yw_SubjectContent> saveContentMethod = fetcher.Fetch(
                subject,
                bll,
                CurrentUserID,
                out content);

            //要删除的关键词
            IList <int> keywordIdsToDelete = null;
            //要添加的关键词
            IList <Yw_SubjectIndex> keywordsToAdd = KeywordFetcher.Fetch(
                subject,
                bll,
                CurrentUserID,
                out keywordIdsToDelete);

            //主知识点
            Yw_SubjectKnowledge          mainKnowledgeEntity = null;
            Action <Yw_SubjectKnowledge> saveKnowledgeMethod = MainKnowledgeFetcher.Fetch(
                subject,
                bll,
                CurrentUserID,
                out mainKnowledgeEntity);

            //次级知识点
            //需要删除的次级知识点
            IEnumerable <int> idsOfknowledgeToDelete = null;
            //需要添加的次级知识点
            IEnumerable <Yw_SubjectKnowledge> knowledgesToAdd =
                SecondaryKnowledgeFetcher.Fetch(
                    subject,
                    bll,
                    CurrentUserID,
                    out idsOfknowledgeToDelete);

            Yw_SubjectProcess process = null;

            if (subject.Button == FormSubmitButton.Submit)
            {
                process = bll.GetNextProcess(
                    subject.Id,
                    CurrentUserID,
                    subject.NextStatus,
                    SubjectActionEnum.提交);
                subjectEntity.Ysj_Status = process.Ysp_Status;
            }

            return(bll.SaveSubject(saveSubjectMethod, subjectEntity,
                                   saveContentMethod, content,
                                   saveKnowledgeMethod, mainKnowledgeEntity,
                                   keywordsToAdd, keywordIdsToDelete,
                                   knowledgesToAdd, idsOfknowledgeToDelete,
                                   process, subject.Button));
        }