public static void Them(string masanpham, string mataikhoan, int soluong, int gia, string tensanpham) { using (var db = new ShopOnlineConnectionDB()) { var x = db.Query <GioHang>("select * from GioHang Where MaTaiKhoan = '" + mataikhoan + "' and MaSanPham = '" + masanpham + "'").ToList(); if (x.Count() > 0) { // gọi hàm update so lượng int a = (int)x.ElementAt(0).SoLuong + soluong; CapNhat(masanpham, mataikhoan, a, gia, tensanpham); } else { GioHang giohang = new GioHang() { MaSanPham = masanpham, MaTaiKhoan = mataikhoan, SoLuong = soluong, Gia = gia, TenSanPham = tensanpham, TongTien = gia * soluong }; db.Insert(giohang); } } }
public static void ThemBT(BinhLuan bl) { // phần Hiền làm // // truy vấn thiếu hoặc sai gì đó var db = new ShopOnlineConnectionDB(); //string a = "insert into BinhLuan(MaSanPham,MaTaiKhoan,NoiDung) values('" + MaSanPham + "','" + MaTaiKhoan + "','" + NoiDung + "')"; db.Insert(bl); }
public static void InsertSP(SanPham sp) { var db = new ShopOnlineConnectionDB(); db.Insert(sp); }
//---------------- Admin public static void ThemNSX(NhaSanXuat nsx) { var db = new ShopOnlineConnectionDB(); db.Insert(nsx); }
//----them---/ public static void Them(LoaiSanPham sx) { var sql = new ShopOnlineConnectionDB(); sql.Insert(sx); }
public static void InsertLSP(LoaiSanPham lsp) { var db = new ShopOnlineConnectionDB(); db.Insert(lsp); }
public static void Them(NhaSanXuat sx) { var sql = new ShopOnlineConnectionDB(); sql.Insert(sx); }