public async Task <GetWechatAppConfigForEditOutput> GetForEdit(NullableIdDto <int> input) { var output = new GetWechatAppConfigForEditOutput() { WechatAppTypeList = WechatAppTypeKVList }; WechatAppConfigEditDto editDto; if (input.Id.HasValue) { var entity = await _entityManager.GetById(input.Id.Value); editDto = ObjectMapper.Map <WechatAppConfigEditDto>(entity); //wechatAppConfigEditDto = ObjectMapper.Map<List<WechatAppConfigEditDto>>(entity); } else { editDto = new WechatAppConfigEditDto(); } output.WechatAppConfig = editDto; return(output); }
/// <summary> /// 编辑WechatAppConfig /// </summary> //[AbpAuthorize(WechatAppConfigAppPermissions.WechatAppConfig_EditWechatAppConfig)] protected virtual async Task UpdateWechatAppConfigAsync(WechatAppConfigEditDto input) { //TODO:更新前的逻辑判断,是否允许更新 var entity = await _wechatappconfigRepository.GetAsync(input.Id.Value); input.MapTo(entity); // ObjectMapper.Map(input, entity); await _wechatappconfigRepository.UpdateAsync(entity); }
protected virtual async Task <WechatAppConfigEditDto> Create(WechatAppConfigEditDto input) { //TODO:新增前的逻辑判断,是否允许新增 // var entity = ObjectMapper.Map <WechatAppConfig>(input); var entity = ObjectMapper.Map <WechatAppConfig>(input); await _entityManager.Create(entity); return(ObjectMapper.Map <WechatAppConfigEditDto>(entity)); }
/// <summary> /// 添加或者修改WechatAppConfig的方法 /// </summary> /// <param name="input">微信配置实体</param> /// <returns></returns> public async Task CreateOrUpdateWechatAppConfigDto(WechatAppConfigEditDto input) { if (input.Id.HasValue) { await UpdateWechatAppConfigAsync(input); } else { await CreateWechatAppConfigAsync(input); } }
protected virtual async Task Update(WechatAppConfigEditDto input) { //TODO:更新前的逻辑判断,是否允许更新 var entity = await _entityManager.GetById(input.Id.Value); // 记录旧的 var oldCreateUserId = entity.CreatorUserId.Value; var oldTenantId = entity.TenantId; ObjectMapper.Map(input, entity); //input.MapTo(entity); // ObjectMapper.Map(input, entity); await _entityManager.Update(entity, oldCreateUserId, oldTenantId); }
/// <summary> /// 导出WechatAppConfig为excel表 /// </summary> /// <returns></returns> //public async Task<FileDto> GetWechatAppConfigsToExcel(){ //var users = await UserManager.Users.ToListAsync(); //var userListDtos = ObjectMapper.Map<List<UserListDto>>(users); //await FillRoleNames(userListDtos); //return _userListExcelExporter.ExportToFile(userListDtos); //} /// <summary> /// MPA版本才会用到的方法 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <GetWechatAppConfigForEditOutput> GetWechatAppConfigForEdit(NullableIdDto <int> input) { var output = new GetWechatAppConfigForEditOutput(); WechatAppConfigEditDto wechatappconfigEditDto; if (input.Id.HasValue) { var entity = await _wechatappconfigRepository.GetAsync(input.Id.Value); wechatappconfigEditDto = entity.MapTo <WechatAppConfigEditDto>(); //wechatappconfigEditDto = ObjectMapper.Map<List <wechatappconfigEditDto>>(entity); } else { wechatappconfigEditDto = new WechatAppConfigEditDto(); } output.WechatAppConfig = wechatappconfigEditDto; return(output); }
/// <summary> /// 新增WechatAppConfig /// </summary> //[AbpAuthorize(WechatAppConfigAppPermissions.WechatAppConfig_CreateWechatAppConfig)] protected virtual async Task <WechatAppConfigEditDto> CreateWechatAppConfigAsync(WechatAppConfigEditDto input) { //TODO:新增前的逻辑判断,是否允许新增 var entity = ObjectMapper.Map <WechatAppConfig>(input); entity.TenantId = AbpSession.TenantId; entity = await _wechatappconfigRepository.InsertAsync(entity); return(entity.MapTo <WechatAppConfigEditDto>()); }