Exemplo n.º 1
0
        /// <summary>
        /// 编辑SystemData
        /// </summary>
        //[AbpAuthorize(SystemDataAppPermissions.SystemData_Edit)]
        protected virtual async Task UpdateSystemDataAsync(SystemDataEditDto input)
        {
            //TODO:更新前的逻辑判断,是否允许更新

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

            input.MapTo(entity);

            // ObjectMapper.Map(input, entity);
            await _systemdataRepository.UpdateAsync(entity);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 新增SystemData
        /// </summary>
        //[AbpAuthorize(SystemDataAppPermissions.SystemData_Create)]
        protected virtual async Task <SystemDataEditDto> CreateSystemDataAsync(SystemDataEditDto input)
        {
            //TODO:新增前的逻辑判断,是否允许新增

            var entity = ObjectMapper.Map <SystemData>(input);

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

            return(entity.MapTo <SystemDataEditDto>());
        }
Exemplo n.º 3
0
 /// <summary>
 /// 更新或修改系统数据
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public async Task CreateOrUpdateSystemDataNew(SystemDataEditDto input)
 {
     if (input.Id.HasValue)
     {
         await UpdateSystemDataAsync(input);
     }
     else
     {
         //input.CreationTime = DateTime.Now;
         await CreateSystemDataAsync(input);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// MPA版本才会用到的方法
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <GetSystemDataForEditOutput> GetSystemDataForEdit(NullableIdDto <int> input)
        {
            var output = new GetSystemDataForEditOutput();
            SystemDataEditDto systemdataEditDto;

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

                systemdataEditDto = entity.MapTo <SystemDataEditDto>();

                //systemdataEditDto = ObjectMapper.Map<List <systemdataEditDto>>(entity);
            }
            else
            {
                systemdataEditDto = new SystemDataEditDto();
            }

            output.SystemData = systemdataEditDto;
            return(output);
        }