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)); } }
// 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)); } }
public static AspNetUser Find(string id) { using (var db = new ElectronicStoreConnectionDB()) { return(db.SingleOrDefault <AspNetUser>("SELECT * FROM AspNetUsers WHERE Id = @0", id)); } }
public static AspNetUserRole UserRoleDetails(string id) { using (var db = new ElectronicStoreConnectionDB()) { return(db.SingleOrDefault <AspNetUserRole>("SELECT * FROM AspNetUserRoles WHERE UserId = @0", id)); } }
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)); } }
public static Category Details(int id) { using (var db = new ElectronicStoreConnectionDB()) { return(db.SingleOrDefault <Category>("WHERE Id = @0", id)); } }
// find image public static Image Find(int id) { using (var db = new ElectronicStoreConnectionDB()) { return(db.SingleOrDefault <Image>("SELECT * FROM Images WHERE Id = @0", id)); } }
// 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); } }
// 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); } }
// 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); } }
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); } }