Example #1
0
 public Category GetCategoryByID(int id)
 {
     var category = new Category();
     using (SqlConnection cn = new SqlConnection(_connectionString))
     {
         var p = new DynamicParameters();
         p.Add("CategoryID", id);
         category = cn.QuerySingle<Category>("GetCategory", p,
             commandType: CommandType.StoredProcedure);
     }
     return category;
 }
Example #2
0
 public StaticPage GetStaticPageById(int id)
 {
     var page = new StaticPage();
     using (SqlConnection cn = new SqlConnection(_connectionString))
     {
         var p = new DynamicParameters();
         p.Add("StaticPageID", id);
         page = cn.QuerySingle<StaticPage>("GetStaticPage", p,
             commandType: CommandType.StoredProcedure);
     }
     return page;
 }