コード例 #1
0
        public async Task <bool> DeleteAsync(int id)
        {
            var farms = await _productRepository.GetProductByCategoryIdAsync(new IdRequestFilter <int>
            {
                Id              = id,
                CanGetDeleted   = true,
                CanGetInactived = true
            });

            if (farms.Any())
            {
                throw new CaminoApplicationException($"Some {nameof(farms)} belong to this farm type need to be deleted or move to another farm type");
            }

            return(await _productCategoryRepository.DeleteAsync(id));
        }
        public async Task <ServiceResponeCode> DeleteAsync(int id)
        {
            if (id == 0)
            {
                return(ServiceResponeCode.INVALID);
            }
            try
            {
                await _productCategoryRepository.DeleteAsync(id);

                return(ServiceResponeCode.OK);
            }
            catch
            {
                return(ServiceResponeCode.ERROR);
            }
        }
コード例 #3
0
        public async Task <ApiRequestResult> DeleteAsync([FromRoute] Guid id)
        {
            await _productCategoryRepository.DeleteAsync(id);

            return(ApiRequestResult.Success("删除成功"));
        }
コード例 #4
0
ファイル: ProductManager.cs プロジェクト: yuxueliang/EShop
        public virtual async Task DeleteAsync(Product product)
        {
            await _productCategoryRepository.DeleteAsync(x => x.ProductId.Equals(product.Id));

            await _productRepository.DeleteAsync(product, true);
        }
コード例 #5
0
        public async Task RemoveProductCategoryAsync(ProductCategory productCategory)
        {
            await _productCategoryRepository.DeleteAsync(productCategory);

            await _dbContext.SaveChangesAsync();
        }
コード例 #6
0
 public async Task <bool> DeleteAsync(int id)
 {
     return(await _productCategoryRepository.DeleteAsync(id));
 }