public ActionResult Buy(string coupon, string phuongthucthanhtoan, string phuongthucvanchuyen)
        {
            using (var db = new Context())
            {
                if (checkLogin() == true)
                {
                    //string coupon = TempData["Coupon"].ToString();
                    int userid     = Convert.ToInt32(Session["id"]);
                    var timkiem    = db.Coupon.Where(s => s.makh == userid && s.tencoupon == coupon && s.check == false).FirstOrDefault();
                    var ctgiohang  = ChiTietGioHangAction.ListCTGioHang();
                    var ctgiohang1 = ctgiohang.Where(s => s.isdeleted == false && s.makh == userid);
                    if (timkiem != null)
                    {
                        //Cần sửa lại giá tiền nếu áp coupon
                        Coupon.CheckCoupon(timkiem.macoupon);
                        foreach (var valueindex in ctgiohang1)
                        {
                            LichSuMuaHang.addLSMuaHang(valueindex.makh, valueindex.masanpham, valueindex.soluong, valueindex.thanhtien);
                            ChiTietGioHangAction.XoaChiTietGioHang(valueindex.mactgiohang);
                        }
                    }
                    else
                    {
                        foreach (var valueindex in ctgiohang1)
                        {
                            LichSuMuaHang.addLSMuaHang(valueindex.makh, valueindex.masanpham, valueindex.soluong, valueindex.thanhtien);
                            ChiTietGioHangAction.XoaChiTietGioHang(valueindex.mactgiohang);
                        }
                    }
                }
                else
                {
                    Session.Remove("Cart");
                }

                return(RedirectToAction("Feature", "TMDT"));
            }
        }
 public ActionResult BuyHistory(int userid)
 {
     ViewBag.BuyHistory = LichSuMuaHang.ListLichSuMuaHang().Where(s => s.makh == userid).ToList();
     return(View());
 }