Exemple #1
0
        public async Task <IActionResult> IssueQuestionnaireAsync(string questionnaireGuid)
        {
            var biz = new QuestionnaireBiz();
            //1.获取文件状态,数据验证
            var model = await biz.GetAsync(questionnaireGuid);

            if (model == null)
            {
                return(Failed(ErrorCode.UserData, "无此问卷数据"));
            }
            if (model.IssuingStatus)
            {
                return(Failed(ErrorCode.UserData, "问卷已发放,无需重复发放"));
            }

            //2.切换问卷状态
            model.IssuingStatus   = true;
            model.IssuingDate     = DateTime.Now;
            model.LastUpdatedBy   = UserID;
            model.LastUpdatedDate = DateTime.Now;
            await biz.UpdateAsync(model);


            //3.发送订阅消息

            return(Success());
        }
Exemple #2
0
        public async Task <IActionResult> ChangerQuestionnaireDisplayAsync([FromBody] ChangerQuestionnaireDisplayRequestDto requestDto)
        {
            var biz   = new QuestionnaireBiz();
            var model = await biz.GetAsync(requestDto.QuestionnaireGuid);

            if (model == null)
            {
                return(Failed(ErrorCode.UserData, "为获取到问卷数据"));
            }
            model.Display         = requestDto.Display;
            model.LastUpdatedBy   = UserID;
            model.LastUpdatedDate = DateTime.Now;
            var result = await biz.UpdateAsync(model);

            return(result ? Success() : Failed(ErrorCode.DataBaseError, "切换问卷显示状态失败"));
        }
Exemple #3
0
        public async Task <IActionResult> SaveQuestionnaireAsync([FromBody] SaveQuestionnaireRequestDto requestDto)
        {
            var biz   = new QuestionnaireBiz();
            var model = await biz.GetAsync(requestDto.QuestionnaireGuid);

            if (model == null)
            {
                return(Failed(ErrorCode.UserData, "不存在此问卷"));
            }
            model.QuestionnaireName = requestDto.QuestionnaireName;
            model.Subhead           = requestDto.Subhead;
            model.LastUpdatedBy     = UserID;
            model.LastUpdatedDate   = DateTime.Now;
            var result = await biz.UpdateAsync(model);

            return(result ? Success() : Failed(ErrorCode.DataBaseError, "保存文件失败"));
        }