public async Task <Models.Product> GetBySku(int Sku) { var product = await _productRepository.GetBySku(Sku); if (product != null) { product.Inventory = new Models.Inventory(); product.Inventory.Warehouses = await _warehouseRepository.GetBySku(Sku); product.Inventory.Quantity = product.Inventory.Warehouses == null ? 0 : product.Inventory.Warehouses.Sum(i => i.Quantity); product.IsMarketable = product.Inventory.Quantity > 0 ? true : false; } return(product); }