Ejemplo n.º 1
0
 static IList <T> GetListByQuery <T>(string query)
 {
     using (var db = new vinabits_homeclickEntities())
     {
         var result = db.Database.SqlQuery <T>(query).ToList();
         return(result);
     }
 }
Ejemplo n.º 2
0
 public static string GetTableName <T>() where T : class
 {
     using (var db = new vinabits_homeclickEntities())
     {
         var result = db.GetTableName <T>();
         return(result);
     }
 }
Ejemplo n.º 3
0
        public static IList <Category> GetProductCategories(CategoryTypes type, int productId)
        {
            using (var db = new vinabits_homeclickEntities())
            {
                var query = string.Format(@"select c.* 
                                        from[ProductDanhSachProducts_CategoryDanhSachCategories] pc
                                            join[Category] c on c.Id = pc.DanhSachCategories and c.Category_typeId = '{0}'
                                        where pc.DanhSachProducts = '{1}'", (int)type, productId);

                var categories = db.Database.SqlQuery <Category>(query).ToList();

                return(categories);
            }
        }