public ActionResult CapNhatGioHang(string sMASACH, FormCollection f)
        {
            SACH s = db.SACHes.SingleOrDefault(n => n.MASACH == sMASACH);

            if (s == null)
            {
                Response.StatusCode = 404;
                return(null);
            }
            List <GioHangSach> listGH = LayGioHang();
            GioHangSach        sp     = listGH.SingleOrDefault(n => n.sMASACH == sMASACH);

            if (sp != null)
            {
                sp.iSOLUONG = int.Parse(f["txtSoLuong"].ToString());
            }
            return(View("GioHangSach"));
        }
        public ActionResult XoaGioHang(string sMASACH)
        {
            SACH s = db.SACHes.SingleOrDefault(n => n.MASACH == sMASACH);

            if (s == null)
            {
                Response.StatusCode = 404;
                return(null);
            }
            List <GioHangSach> listGH = LayGioHang();
            GioHangSach        sp     = listGH.SingleOrDefault(n => n.sMASACH == sMASACH);

            if (sp != null)
            {
                listGH.RemoveAll(n => n.sMASACH == sMASACH);
                return(View(s));
            }
            if (listGH.Count == 0)
            {
                return(RedirectToAction("Index", "Home"));
            }
            return(RedirectToAction("GioHangSach"));
        }
        public ActionResult ThemGioHang(string sMASACH, string strURL)
        {
            SACH s = db.SACHes.SingleOrDefault(n => n.MASACH == sMASACH);

            if (s == null)
            {
                Response.StatusCode = 404;
                return(null);
            }
            List <GioHangSach> listGH = LayGioHang();
            GioHangSach        sp     = listGH.Find(n => n.sMASACH == sMASACH);

            if (sp == null)
            {
                sp = new GioHangSach(sMASACH);
                listGH.Add(sp);
                return(Redirect(strURL));
            }
            else
            {
                sp.iSOLUONG++;
                return(Redirect(strURL));
            }
        }