/// <summary> /// 编辑CustomerAddress /// </summary> protected virtual async Task UpdateCustomerAddressAsync(CustomerAddressEditDto input) { //TODO:更新前的逻辑判断,是否允许更新 var entity = await _customeraddressRepository.GetAsync(input.Id.Value); input.MapTo(entity); // ObjectMapper.Map(input, entity); await _customeraddressRepository.UpdateAsync(entity); }
/// <summary> /// 导出CustomerAddress为excel表 /// </summary> /// <returns></returns> //public async Task<FileDto> GetCustomerAddresssToExcel(){ //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 <GetCustomerAddressForEditOutput> GetCustomerAddressForEdit(NullableIdDto <int> input) { var output = new GetCustomerAddressForEditOutput(); CustomerAddressEditDto customeraddressEditDto; if (input.Id.HasValue) { var entity = await _customeraddressRepository.GetAsync(input.Id.Value); customeraddressEditDto = entity.MapTo <CustomerAddressEditDto>(); //customeraddressEditDto = ObjectMapper.Map<List <customeraddressEditDto>>(entity); } else { customeraddressEditDto = new CustomerAddressEditDto(); } output.CustomerAddress = customeraddressEditDto; return(output); }
/// <summary> /// 新增CustomerAddress /// </summary> protected virtual async Task <CustomerAddressEditDto> CreateCustomerAddressAsync(CustomerAddressEditDto input) { //TODO:新增前的逻辑判断,是否允许新增 var entity = ObjectMapper.Map <CustomerAddress>(input); entity = await _customeraddressRepository.InsertAsync(entity); return(entity.MapTo <CustomerAddressEditDto>()); }