コード例 #1
0
        public async Task <bool> RemoveTrendingProduct(RemoveTrendingProductDto trendingProduct)
        {
            _context.Remove(trendingProduct.Adapt <TrendingProduct>());
            await _context.SaveChangesAsync();

            return(await Task.FromResult(true));
        }
コード例 #2
0
        public async Task <Response <TrendingProduct> > RemoveTrendingProduct(RemoveTrendingProductDto trendingProduct)
        {
            var httpResponse = new Response <TrendingProduct>();

            try
            {
                httpResponse.RequestState = true;
                httpResponse.ErrorState   = !await _productManager.RemoveTrendingProduct(trendingProduct);
            }
            catch (Exception ex)
            {
                httpResponse.ErrorState = true;
                httpResponse.ErrorList.Add(ex.Adapt <ApiException>());
            }
            return(httpResponse);
        }