/// <summary> /// 编辑WechatSubscribe /// </summary> //[AbpAuthorize(WechatSubscribeAppPermissions.WechatSubscribe_EditWechatSubscribe)] protected virtual async Task UpdateWechatSubscribeAsync(WechatSubscribeEditDto input) { //TODO:更新前的逻辑判断,是否允许更新 var entity = await _wechatsubscribeRepository.GetAsync(input.Id.Value); input.MapTo(entity); // ObjectMapper.Map(input, entity); await _wechatsubscribeRepository.UpdateAsync(entity); }
/// <summary> /// 添加或者修改WechatSubscribe的方法 /// </summary> /// <param name="input">被关注回复实体</param> /// <returns></returns> public async Task CreateOrUpdateWechatSubscribeDto(WechatSubscribeEditDto input) { if (input.Id.HasValue) { await UpdateWechatSubscribeAsync(input); } else { await CreateWechatSubscribeAsync(input); } }
/// <summary> /// 新增WechatSubscribe /// </summary> protected virtual async Task <WechatSubscribeEditDto> Create(WechatSubscribeEditDto input) { //TODO:新增前的逻辑判断,是否允许新增 // var entity = ObjectMapper.Map <WechatSubscribe>(input); var entity = input.MapTo <WechatSubscribe>(); entity = await _entityRepository.InsertAsync(entity); return(entity.MapTo <WechatSubscribeEditDto>()); }
/// <summary> /// 导出WechatSubscribe为excel表 /// </summary> /// <returns></returns> //public async Task<FileDto> GetWechatSubscribesToExcel(){ //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 <GetWechatSubscribeForEditOutput> GetWechatSubscribeForEdit(NullableIdDto <Guid> input) { var output = new GetWechatSubscribeForEditOutput(); WechatSubscribeEditDto wechatsubscribeEditDto; if (input.Id.HasValue) { var entity = await _wechatsubscribeRepository.GetAsync(input.Id.Value); wechatsubscribeEditDto = entity.MapTo <WechatSubscribeEditDto>(); //wechatsubscribeEditDto = ObjectMapper.Map<List <wechatsubscribeEditDto>>(entity); } else { wechatsubscribeEditDto = new WechatSubscribeEditDto(); } output.WechatSubscribe = wechatsubscribeEditDto; return(output); }
/// <summary> /// 新增WechatSubscribe /// </summary> //[AbpAuthorize(WechatSubscribeAppPermissions.WechatSubscribe_CreateWechatSubscribe)] protected virtual async Task <WechatSubscribeEditDto> CreateWechatSubscribeAsync(WechatSubscribeEditDto input) { //TODO:新增前的逻辑判断,是否允许新增 var entity = ObjectMapper.Map <WechatSubscribe>(input); entity.TenantId = AbpSession.TenantId; entity = await _wechatsubscribeRepository.InsertAsync(entity); return(entity.MapTo <WechatSubscribeEditDto>()); }