
上QQ阅读APP看书,第一时间看更新
Writing a product service
For the sake of simplicity, our product service has two functions:
- List<int> getProducts(int categoryId)
- Product getProduct(int prodId)
The intent of the two methods is quite clear. The first returns a list of product IDs given a category ID, and the second returns product details (as an object) given a product ID.