public bool ThemGioHang(int makh) { var giohang = new GioHang() { MaKH = makh, }; db.GioHangs.Add(giohang); int kq = db.SaveChanges(); if (kq > 0) { return(true); } return(false); }
public List <ThongTinTungMon> HienThiGioHang(int MaKH) { GioHang temp = db.GioHangs.Find(MaKH); var model = from a in db.ChiTiet_GioHang join b in db.MonAns on a.MaMonAn equals b.MaMon where a.MaGioHang == temp.MaGioHang select new ThongTinTungMon() { TenMon = b.TenMon, DonGia = b.DonGia, LinkAnh = b.LinkAnh, SoLuong = a.SoLuong }; return(model.ToList()); }