public async Task <MessageModel <bool> > Put([FromBody] QuestionType QuestionType)
        {
            if (QuestionType == null || !(QuestionType.Id > 0))
            {
                return(new MessageModel <bool>()
                {
                    msg = "参数异常",
                    response = false
                });
            }

            var isSuc = await _questionTypeRepository.Update(QuestionType);

            return(new MessageModel <bool>()
            {
                msg = isSuc ? "更新成功" : "更新失败",
                success = isSuc,
                response = isSuc
            });
        }
示例#2
0
        public bool Save(QuestionType element)
        {
            if (element.Id == 0)
            {
                element = _questionTypeRepo.Add(element);
            }
            else
            {
                element = _questionTypeRepo.Update(element);
            }

            return(true);
        }