public static LOAISANPHAM GetCategory(int id) { using (var db = new shopDB()) { return(db.SingleOrDefault <LOAISANPHAM>("select * from LOAISANPHAM where MaLoaiSanPham = @0", id)); } }
public static SANPHAM GetProduct(int id) { using (var db = new shopDB()) { return(db.SingleOrDefault <SANPHAM>("select * from SANPHAM where MaSanPham = @0", id)); } }
public static void UpdateCategory(LOAISANPHAM lsp) { using (var db = new shopDB()) { db.Update <LOAISANPHAM>("SET TenLoaiSanPham=@0 WHERE MaLoaiSanPham=@1", lsp.TenLoaiSanPham, lsp.MaLoaiSanPham); } }
public static void Delete(int id) { try { using (var db = new shopDB()) { db.Execute("delete from LOAISANPHAM where MaLoaiSanPham = @0", id); } } catch { } }
public static void UpdateProduct(SANPHAM Sp, int valueImg) { if (valueImg == 0) { using (var db = new shopDB()) { db.Update <SANPHAM>("SET TenSanPham=@0, Gia=@1, GiamGia=@2,MoTa=@3, LoaiSp=@4 WHERE MaSanPham=@5", Sp.TenSanPham, Sp.Gia, Sp.GiamGia, Sp.MoTa, Sp.LoaiSp, Sp.MaSanPham); } } else { using (var db = new shopDB()) { db.Update <SANPHAM>("SET TenSanPham=@0, Gia=@1, GiamGia=@2, HinhAnh=@3, MoTa=@4, LoaiSp=@5 WHERE MaSanPham=@6", Sp.TenSanPham, Sp.Gia, Sp.GiamGia, Sp.HinhAnh, Sp.MoTa, Sp.LoaiSp, Sp.MaSanPham); } } }
public static IEnumerable <LOAISANPHAM> List() { var db = new shopDB(); return(db.Query <LOAISANPHAM>("select * from loaisanpham")); }
public static Page <SANPHAM> SanPham(int pagenume, int itemperpage, int id) { var db = new shopDB(); return(db.Page <SANPHAM>(pagenume, itemperpage, "select * from sanpham where LoaiSP = @0", id)); }
public static SANPHAM GetProduct(int id) { var db = new shopDB(); return(db.SingleOrDefault <SANPHAM>("select * from sanpham where MaSanPham = @0", id)); }