public static IEnumerable <DonDatHang> DanhSach() { var db = new SmartShopConnectionDB(); var dsDH = db.Query <DonDatHang>("select * from DonDatHang"); List <DonDatHang> model = new List <DonDatHang>(); /* foreach (var item in dsCL) * { * viewMenu clvm = new viewMenu(); * clvm.MaCL = item.MaCL; * clvm.TenCL = item.TenCL; * clvm.dsLoai = db.Query<Loai>("select * from Loai where MaCL=@0", item.MaCL); * model.Add(clvm); * }*/ return(db.Query <DonDatHang>("SELECT * FROM DonDatHang")); }
public static IEnumerable <viewMenu> Menu() { var db = new SmartShopConnectionDB(); //return db.Query<viewMenu>("SELECT * FROM viewMenu"); var dsCL = db.Query <viewMenu>("select chungloai.MaCL,chungloai.TenCL from chungloai"); List <viewMenu> model = new List <viewMenu>(); foreach (var item in dsCL) { viewMenu clvm = new viewMenu(); clvm.MaCL = item.MaCL; clvm.TenCL = item.TenCL; clvm.dsLoai = db.Query <Loai>("select * from Loai where MaCL=@0", item.MaCL); model.Add(clvm); } return(model); }
public static IEnumerable <DonDatHang> DsDHUs(string id) { var db = new SmartShopConnectionDB(); var dsDH = db.Query <DonDatHang>("select * from DonDatHang where Username=@0 ORDER BY NgayDatHang DESC", id); List <DonDatHang> model = new List <DonDatHang>(); foreach (var item in dsDH) { DonDatHang dh = new DonDatHang(); dh.MaDH = item.MaDH; dh.Username = item.Username; dh.NgayDatHang = item.NgayDatHang; dh.HoTen = item.HoTen; dh.GhiChu = item.GhiChu; dh.DiaChi = item.DiaChi; dh.Email = item.Email; dh.SDT = item.SDT; dh.TinhTrang = item.TinhTrang; dh.Tongtien = item.Tongtien; dh.DsctDH = db.Query <View_CTDH>("select * from [DAn_Web2].[dbo].[View_CTDH] where MaDH=@0", item.MaDH); model.Add(dh); } return(model); }
public static IEnumerable <DonDatHang> DanhSach() { var db = new SmartShopConnectionDB(); var dsDH = db.Query <DonDatHang>("select * from DonDatHang"); List <DonDatHang> model = new List <DonDatHang>(); foreach (var item in dsDH) { DonDatHang dh = new DonDatHang(); dh.MaDH = item.MaDH; dh.Username = item.Username; dh.NgayDatHang = item.NgayDatHang; dh.HoTen = item.HoTen; dh.GhiChu = item.GhiChu; dh.DiaChi = item.DiaChi; dh.Email = item.Email; dh.SDT = item.SDT; dh.TinhTrang = item.TinhTrang; dh.Tongtien = item.Tongtien; dh.DsctDH = db.Query <View_CTDH>("select * from ChiTietDH where MaDH=@0", item.MaDH); model.Add(dh); } return(model); }
// // GET: /Cart/ public ActionResult Index() { var db = new SmartShopConnectionDB(); List <Cart> ds_SP = new List <Cart>(); List <string> sp = new List <string>(); sp = (List <string>)Session["sp_gh"]; if (sp != null) { foreach (var item in sp) { Cart sp_gh = new Cart(); sp_gh.dsSP = db.Query <Product>("select * from Product where MaSP=@0", item.ToString()); ds_SP.Add(sp_gh); } } return(View(ds_SP)); }
public static IEnumerable <viewLoai> DanhSachView() { var db = new SmartShopConnectionDB(); return(db.Query <viewLoai>("SELECT * FROM viewLoai")); }
public static IEnumerable <ChungLoai> DanhSach() { var db = new SmartShopConnectionDB(); return(db.Query <ChungLoai>("SELECT * FROM chungloai")); }
public static IEnumerable <Image> DsTheoSP(string masp) { var db = new SmartShopConnectionDB(); return(db.Query <Image>("SELECT * FROM Image where MaSP=@0", masp)); }