Created
August 5, 2017 22:15
-
-
Save aramkoukia/b8f10403223e0c1cf12e976d5fb621bb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class DapperRepository | |
| { | |
| public List<Product> GetAllProductsByCategory(int categoryId) | |
| { | |
| using (IDbConnection db = new SqlConnection(@"Connection String")) | |
| { | |
| return db.Query<Product> | |
| ($"SELECT * From [SalesLT].[Product] INNER JOIN [SalesLT].[ProductCategory] ON [SalesLT].[ProductCategory].ProductCategoryId = [SalesLT].[Product].ProductCategoryId WHERE [SalesLT].[ProductCategory].ProductCategoryId ={categoryId}").ToList(); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment