예제 #1
0
 // get images by product id
 public static IEnumerable <Image> List(int?id)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         return(db.Query <Image>("SELECT * FROM Images WHERE ProductId = @0", id));
     }
 }
예제 #2
0
 // edit image
 public static void Edit(Image image)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         db.Update(image);
     }
 }
예제 #3
0
 // add new image
 public static void Add(Image image)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         db.Insert(image);
     }
 }
예제 #4
0
 // find image
 public static Image Find(int id)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         return(db.SingleOrDefault <Image>("SELECT * FROM Images WHERE Id = @0", id));
     }
 }
예제 #5
0
 public static IEnumerable <Order> List()
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         return(db.Query <Order>("SELECT * FROM Orders ORDER BY OrderDate DESC"));
     }
 }
예제 #6
0
파일: UserBus.cs 프로젝트: 1461634/DoAnWeb2
 public static void Add(View_Profile entity)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         db.Insert(entity);
     }
 }
예제 #7
0
 public static IEnumerable <Comment> ProductComments(int id)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         return(db.Query <Comment>("SELECT * FROM Comments WHERE Status = 1 AND ProductId = @0 ORDER BY DateCreated DESC", id));
     }
 }
예제 #8
0
파일: UserBus.cs 프로젝트: 1461634/DoAnWeb2
 public static AspNetUser Find(string id)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         return(db.SingleOrDefault <AspNetUser>("SELECT * FROM AspNetUsers WHERE Id = @0", id));
     }
 }
예제 #9
0
파일: UserBus.cs 프로젝트: 1461634/DoAnWeb2
 public static IEnumerable <Order> OrderPurchase(string id)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         return(db.Query <Order>("SELECT * FROM Orders WHERE UserId = @0 ORDER By OrderDate DESC", id));
     }
 }
예제 #10
0
파일: UserBus.cs 프로젝트: 1461634/DoAnWeb2
 public static View_Profile Details(string id)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         return(db.SingleOrDefault <View_Profile>("SELECT * FROM View_Profile WHERE Id = @0", id));
     }
 }
예제 #11
0
파일: UserBus.cs 프로젝트: 1461634/DoAnWeb2
 public static IEnumerable <View_PurchaseHistory> PurchaseHistory(string id)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         return(db.Query <View_PurchaseHistory>("SELECT DISTINCT * FROM View_PurchaseHistory WHERE Id = @0", id));
     }
 }
예제 #12
0
 public static int Edit(Category entity)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         return(db.Update(entity));
     }
 }
예제 #13
0
 public static void Add(Category entity)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         db.Insert(entity);
     }
 }
예제 #14
0
 public static void Add(OrderDetail entity)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         db.Insert(entity);
     }
 }
예제 #15
0
파일: UserBus.cs 프로젝트: 1461634/DoAnWeb2
 public static AspNetUserRole UserRoleDetails(string id)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         return(db.SingleOrDefault <AspNetUserRole>("SELECT * FROM AspNetUserRoles WHERE UserId = @0", id));
     }
 }
예제 #16
0
 public static IEnumerable <View_OrderDetail> Details(int id)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         return(db.Query <View_OrderDetail>("SELECT * FROM View_OrderDetails WHERE Id = @0", id));
     }
 }
예제 #17
0
 // get top 10 best selling products
 public static IEnumerable <Product> Top10Featured()
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         return(db.Query <Product>("SELECT TOP 10 * FROM Products WHERE Sold > 0 ORDER BY Sold DESC"));
     }
 }
예제 #18
0
 public static void Insert(Comment entity)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         db.Insert(entity);
     }
 }
예제 #19
0
 // delete a product
 public static int Delete(int id)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         return(db.Delete <Product>("WHERE Id = @0", id));
     }
 }
예제 #20
0
 // get products list
 public static IEnumerable <Product> List()
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         return(db.Query <Product>("SELECT * FROM Products ORDER BY DateModified DESC, DateCreated DESC"));
     }
 }
예제 #21
0
 // add new product
 public static void Add(Product p)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         db.Insert(p);
     }
 }
예제 #22
0
 public static View_Product ViewProduct(int id)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         return(db.SingleOrDefault <View_Product>("SELECT * FROM View_Product WHERE Id = @0", id));
     }
 }
예제 #23
0
 public static IEnumerable <Brand> List()
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         return(db.Query <Brand>("SELECT * FROM Brands WHERE Status = 1 ORDER BY Name"));
     }
 }
예제 #24
0
 // get product by id
 public static Product Find(int?id)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         return(db.SingleOrDefault <Product>("SELECT * FROM Products WHERE Id = @0", id));
     }
 }
예제 #25
0
 public static IEnumerable <View_ThreeMonthsStatistic> ThreeMonthsStatistics()
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         return(db.Query <View_ThreeMonthsStatistic>("SELECT * FROM View_ThreeMonthsStatistics"));
     }
 }
예제 #26
0
파일: UserBus.cs 프로젝트: 1461634/DoAnWeb2
 public static int RoleEdit(AspNetUserRole entity)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         return(db.Update(entity));
     }
 }
예제 #27
0
 public static Category Details(int id)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         return(db.SingleOrDefault <Category>("WHERE Id = @0", id));
     }
 }
예제 #28
0
파일: UserBus.cs 프로젝트: 1461634/DoAnWeb2
 public static IEnumerable <View_Profile> List()
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         return(db.Query <View_Profile>("SELECT * FROM View_Profile ORDER BY Email, FirstName, LastName"));
     }
 }
예제 #29
0
 public static int Insert(Order o)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         db.Insert(o);
         return(o.Id);
     }
 }
예제 #30
0
파일: UserBus.cs 프로젝트: 1461634/DoAnWeb2
 public static int Delete(string id)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         var user = Details(id);
         return(db.Delete(user));
     }
 }