protected virtual async Task <GAGoodsEditDto> CreateGAGoodsAsync(GAGoodsEditDto input) { //TODO:新增前的逻辑判断,是否允许新增 var entity = ObjectMapper.Map <GAGoods>(input); entity = await _gagoodsRepository.InsertAsync(entity); return(entity.MapTo <GAGoodsEditDto>()); }
protected virtual async Task UpdateGAGoodsAsync(GAGoodsEditDto input) { //TODO:更新前的逻辑判断,是否允许更新 var entity = await _gagoodsRepository.GetAsync(input.Id.Value); input.MapTo(entity); // ObjectMapper.Map(input, entity); await _gagoodsRepository.UpdateAsync(entity); }
/// <summary> /// 导出GAGoods为excel表 /// </summary> /// <returns></returns> //public async Task<FileDto> GetGAGoodssToExcel(){ //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 <GetGAGoodsForEditOutput> GetGAGoodsForEdit(NullableIdDto <int> input) { var output = new GetGAGoodsForEditOutput(); GAGoodsEditDto gagoodsEditDto; if (input.Id.HasValue) { var entity = await _gagoodsRepository.GetAsync(input.Id.Value); gagoodsEditDto = entity.MapTo <GAGoodsEditDto>(); //gagoodsEditDto = ObjectMapper.Map<List <gagoodsEditDto>>(entity); } else { gagoodsEditDto = new GAGoodsEditDto(); } output.GAGoods = gagoodsEditDto; return(output); }