Esempio n. 1
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));
     }
 }
Esempio n. 2
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));
     }
 }
Esempio n. 3
0
 public static AspNetUser Find(string id)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         return(db.SingleOrDefault <AspNetUser>("SELECT * FROM AspNetUsers WHERE Id = @0", id));
     }
 }
Esempio n. 4
0
 public static AspNetUserRole UserRoleDetails(string id)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         return(db.SingleOrDefault <AspNetUserRole>("SELECT * FROM AspNetUserRoles WHERE UserId = @0", id));
     }
 }
Esempio n. 5
0
 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));
     }
 }
Esempio n. 6
0
 public static Category Details(int id)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         return(db.SingleOrDefault <Category>("WHERE Id = @0", id));
     }
 }
Esempio n. 7
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));
     }
 }
Esempio n. 8
0
 // get product details by id
 public static Product Details(int?id)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         var product = db.SingleOrDefault <Product>("SELECT * FROM Products WHERE Id = @0", id);
         product.Viewed += 1;
         db.Update(product);
         return(product);
     }
 }
Esempio n. 9
0
 // delete image
 public static bool ChangeStatus(int id)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         var image = db.SingleOrDefault <Image>("WHERE Id = @0", id);
         image.Status = !image.Status;
         db.Save(image);
         return(image.Status);
     }
 }
Esempio n. 10
0
 // change status of product
 public static bool ChangeStatus(int id)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         var product = db.SingleOrDefault <Product>("WHERE Id = @0", id);
         product.Status       = !product.Status;
         product.DateModified = DateTime.Now;
         db.Save(product);
         return(product.Status);
     }
 }
Esempio n. 11
0
 public static int ChangeStatus(int id)
 {
     using (var db = new ElectronicStoreConnectionDB())
     {
         var order = db.SingleOrDefault <Order>("WHERE Id = @0", id);
         if (order.Status == 0)
         {
             order.Status = 1;
         }
         else if (order.Status == 1)
         {
             order.Status = 2;
         }
         else
         {
             order.Status = 2;
         }
         db.Save(order);
         return(order.Status);
     }
 }