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); } }
public async Task <ApiRequestResult> DeleteAsync([FromRoute] Guid id) { await _productCategoryRepository.DeleteAsync(id); return(ApiRequestResult.Success("删除成功")); }
public virtual async Task DeleteAsync(Product product) { await _productCategoryRepository.DeleteAsync(x => x.ProductId.Equals(product.Id)); await _productRepository.DeleteAsync(product, true); }
public async Task RemoveProductCategoryAsync(ProductCategory productCategory) { await _productCategoryRepository.DeleteAsync(productCategory); await _dbContext.SaveChangesAsync(); }
public async Task <bool> DeleteAsync(int id) { return(await _productCategoryRepository.DeleteAsync(id)); }