Exemplo n.º 1
0
        /// <summary>
        /// 编辑DingTalkConfig
        /// </summary>

        protected virtual async Task UpdateAsync(DingTalkConfigEditDto input)
        {
            //TODO:更新前的逻辑判断,是否允许更新

            var entity = await _entityRepository.GetAsync(input.Id.Value);

            input.MapTo(entity);

            // ObjectMapper.Map(input, entity);
            await _entityRepository.UpdateAsync(entity);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加或者修改DingTalkConfig的公共方法
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>

        public async Task CreateOrUpdateAsync(DingTalkConfigEditDto input)
        {
            if (input.Id.HasValue)
            {
                await UpdateAsync(input);
            }
            else
            {
                input.CreationTime = DateTime.Now;
                await CreateAsync(input);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 新增DingTalkConfig
        /// </summary>

        protected virtual async Task <DingTalkConfigEditDto> CreateAsync(DingTalkConfigEditDto input)
        {
            //TODO:新增前的逻辑判断,是否允许新增


            // var entity = ObjectMapper.Map <DingTalkConfig>(input);
            var entity = input.MapTo <DingTalkConfig>();

            entity.CreationTime = DateTime.Now;
            entity = await _entityRepository.InsertAsync(entity);

            return(entity.MapTo <DingTalkConfigEditDto>());
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获取编辑 DingTalkConfig
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>

        public async Task <GetDingTalkConfigForEditOutput> GetForEditAsync(NullableIdDto <int> input)
        {
            var output = new GetDingTalkConfigForEditOutput();
            DingTalkConfigEditDto editDto;

            if (input.Id.HasValue)
            {
                var entity = await _entityRepository.GetAsync(input.Id.Value);

                editDto = entity.MapTo <DingTalkConfigEditDto>();

                //dingTalkConfigEditDto = ObjectMapper.Map<List<dingTalkConfigEditDto>>(entity);
            }
            else
            {
                editDto = new DingTalkConfigEditDto();
            }

            output.DingTalkConfig = editDto;
            return(output);
        }