convert model to viewmodel [duplicate]
问题 This question already has answers here : Where to convert business model to view model? (3 answers) Closed 2 years ago . I have a table name "Product" and another table name "category". Product table has 'productID', 'productName' and 'CategoryID'. Category table has 'categoryID' and 'categoryName'. My target is to display a list of products with category. The list will contain 'product id', 'product name' and 'category name'. I have created a viewmodel. the code is public int prodID{get;set;