Ejemplo n.º 1
0
        public async Task <BaseResponse> UpdateTypeModuleFeedbackAsync(string Account, TypeModuleFeedbackUpdateDto req)
        {
            var data = await _tmfr.FindAsync(req.Id);

            if (data == null)
            {
                return(new BaseResponse {
                    Success = false, Message = "输入的数据不存在"
                });
            }
            var count = await _tmfr.Find(a => a.ModuleControlId == req.ModuleControlId && a.DataDefineId == req.DataDefineId && a.Id != req.Id).CountAsync();

            if (count > 0)
            {
                return(new BaseResponse {
                    Success = false, Message = "该控制项下已存在相同的反馈数据"
                });
            }
            try
            {
                var entity = _map.Map(req, data);
                entity.Modify     = Account;
                entity.ModifyTime = DateTime.Now;
                await _tmfr.SaveAsync(entity);

                _log.LogInformation($"{Account}修改标示为{req.Id}的反馈数据成功");
                return(new BaseResponse {
                    Success = true, Message = "修改数据成功"
                });
            }
            catch (Exception ex)
            {
                _log.LogError($"{Account}修改标示为{req.Id}的反馈项失败,失败原因:{ex.Message}->{ex.StackTrace}->{ex.InnerException}");
                return(new BaseResponse {
                    Success = false, Message = "修改数据失败,请联系管理员"
                });
            }
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <BaseResponse> > UpdateTypeModuleFeedbackAsync(int typeId, [FromBody] TypeModuleFeedbackUpdateDto req)
        {
            string Account = User.Claims.FirstOrDefault(a => a.Type == "Account").Value;

            #region 检测类型
            var type = await _ts.CheckTypeAsync(typeId);

            if (!type.IsExist)
            {
                return(new BaseResponse {
                    Success = false, Message = "输入的类型编号不存在"
                });
            }
            if (type.Status == 0)
            {
                return(new BaseResponse {
                    Success = false, Message = "该类型为目录型节点,不允许添加数据"
                });
            }
            #endregion
            #region 检测数据定义标示是否存在
            var td = await _td.IsExist(a => a.Id == req.DataDefineId);

            if (!td)
            {
                return(new BaseResponse {
                    Success = false, Message = "输入的类型数据定义不存在"
                });
            }
            #endregion
            var rm = await _tfs.UpdateTypeModuleFeedbackAsync(Account, req);

            return(rm);
        }