コード例 #1
0
        public JsonResult DatHang(string tenkh, string email, string diachinhan, string sdtnhan, int trangthai)
        {
            //lay thong tin cac mat hang dat tu session
            Khachhang kh = new Khachhang();

            kh.tenkh     = tenkh;
            kh.email     = email;
            kh.sdt       = sdtnhan;
            kh.diachi    = diachinhan;
            kh.email     = email;
            kh.trangthai = trangthai;
            int            thanhtien = 0;
            List <CTDHang> ds        = new List <CTDHang>();
            int            total     = 0;

            if (Session["GioHang"] == null)
            {
                Session["GioHang"] = new List <CTDHang>();
                thanhtien          = 0;
            }
            else
            {
                ds        = Session["GioHang"] as List <CTDHang>;
                thanhtien = Convert.ToInt32(ds.Sum(s => s.DonGia * s.SoLuong));
            }
            ds = Session["GioHang"] as List <CTDHang>;
            caycanhModel   a    = new caycanhModel();
            List <caycanh> dsss = a.LaySPham();

            foreach (CTDHang ct in ds)
            {
                foreach (caycanh sp in dsss)
                {
                    if (sp.macaycanh == ct.MaSP)
                    {
                        a.SuaSLSP(ct.MaSP, ct.SoLuong);
                    }
                }
            }
            checkoutBus mhb = new checkoutBus();

            mhb.MuaHang(kh, thanhtien, ds, diachinhan, sdtnhan, trangthai);
            Session["GioHang"] = null;

            return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
ファイル: caycanhBus.cs プロジェクト: huonghuong291019/doan3
        public List <caycanh> LaySPham()
        {
            List <caycanh> lsp = spm.LaySPham();

            return(lsp);
        }
コード例 #3
0
ファイル: loaiBus.cs プロジェクト: huonghuong291019/doan3
 public List <caycanh> LaySanPhamTK(string tk)
 {
     return(db.LaySPham().Where(x => (x.tencaycanh.ToLower().Contains(tk.ToLower()))).ToList());
 }