/// <summary> /// 新增Product /// </summary> protected virtual async Task <ProductEditDto> Create(ProductEditDto input) { var entity = input.MapTo <Product>(); var id = await _entityRepository.InsertAndGetIdAsync(entity); return(entity.MapTo <ProductEditDto>()); }
/// <summary> /// 新增产品 /// </summary> public virtual async Task <ProductEditDto> CreateProductAsync(ProductEditDto input) { var entity = input.MapTo <Product>(); entity = await _productRepository.InsertAsync(entity); return(entity.MapTo <ProductEditDto>()); }
/// <summary> /// 编辑产品 /// </summary> public virtual async Task UpdateProductAsync(ProductEditDto input) { var entity = await _productRepository.GetAsync(input.Id.Value); input.MapTo(entity); await _productRepository.UpdateAsync(entity); }
/// <summary> /// 编辑Product /// </summary> protected virtual async Task <ProductEditDto> Update(ProductEditDto input) { var entity = await _entityRepository.GetAsync(input.Id.Value); input.MapTo(entity); await _entityRepository.UpdateAsync(entity); return(entity.MapTo <ProductEditDto>()); }
protected virtual async Task UpdateProductAsync(ProductEditDto input) { var entity = await _productRepository.GetAsync(input.Id.Value); input.MapTo(entity); // ObjectMapper.Map(input, entity); await _productRepository.UpdateAsync(entity); }
protected virtual async Task Update(ProductEditDto input) { //TODO:更新前的逻辑判断,是否允许更新 var entity = await _entityRepository.GetAsync(input.Id.Value); input.MapTo(entity); // ObjectMapper.Map(input, entity); await _entityRepository.UpdateAsync(entity); }
/// <summary> /// 编辑Product /// </summary> //[AbpAuthorize(ProductAppPermissions.Product_EditProduct)] protected virtual async Task <ProductListDto> UpdateProductAsync(ProductEditDto input) { //TODO:更新前的逻辑判断,是否允许更新 var entity = await _productRepository.GetAsync(input.Id.Value); input.MapTo(entity); // ObjectMapper.Map(input, entity); var result = await _productRepository.UpdateAsync(entity); return(result.MapTo <ProductListDto>()); }
protected virtual async Task <ProductEditDto> Create(ProductEditDto input) { //TODO:新增前的逻辑判断,是否允许新增 // var entity = ObjectMapper.Map <Product>(input); var entity = input.MapTo <Product>(); entity = await _entityRepository.InsertAsync(entity); return(entity.MapTo <ProductEditDto>()); }
/// <summary> /// 编辑产品 /// </summary> //[AbpAuthorize(ProductAppPermissions.Product_EditProduct)] public virtual async Task UpdateProductAsync(ProductEditDto input) { //TODO:更新前的逻辑判断,是否允许更新 var entity = await _productRepository.GetAsync(input.Id.Value); input.MapTo(entity); await _productRepository.UpdateAsync(entity); //await _cashbackRepository.UpdateAsync(entity.Cashback); //await _remarkRepository.UpdateAsync(entity.Remark); }
public virtual async Task <ProductEditDto> CreateProductAsync(ProductEditDto input) { //TODO:新增前的逻辑判断,是否允许新增 var entity = input.MapTo <Product>(); // entity.VerifyStatus = VerifyStatus.Pending; // entity.ReleaseStatus = ReleaseStatus.UnPublished; entity = await _productRepository.InsertAsync(entity); return(entity.MapTo <ProductEditDto>()); }
public async Task SaveAsync(ProductEditDto input) { var item = input.MapTo <Product>(); item.PYCode = item.Name.GetChineseSpell(); if (input.Id == Guid.Empty) { if (this.productRepository.Count(r => r.Code == input.Code) > 0) { throw new UserFriendlyException("当前商品已存在"); } await this.productRepository.InsertAsync(item); } else { var old = this.productRepository.Get(input.Id); Mapper.Map(input, old); await this.productRepository.UpdateAsync(old); } }
protected async Task CreateProductAsync(ProductEditDto input) { var model = input.MapTo <Product>(); await _productRepository.InsertAsync(model); }
protected async Task UpdateProductAsync(ProductEditDto input) { var entity = await _productRepository.GetAsync(input.Id.Value); await _productRepository.UpdateAsync(input.MapTo(entity)); }
protected async Task CreateProductAsync(ProductEditDto input) { await _productRepository.InsertAsync(input.MapTo <Product>()); }