Пример #1
0
        // Đặt hàng

        public ActionResult DatHang(string tentk, string ten, string sdt, string diaChi, string ChuThich)
        {
            HoaDonBan dt = new HoaDonBan();

            dt.tenTk    = tentk;
            dt.tenNn    = ten;
            dt.dcNn     = diaChi;
            dt.sdtNn    = sdt;
            dt.chuThich = ChuThich;
            hdb.themHDB(dt);

            int lastID = hdb.lastID();

            if (Session["giohang"] != null)
            {
                var tt = (List <GioHang>)Session["giohang"];
                foreach (GioHang t in tt)
                {
                    ChiTietHoaDonBan ct = new ChiTietHoaDonBan();
                    ct.maHoaDonBan = lastID;
                    ct.maSp        = t.id;
                    ct.soLuong     = t.sl;
                    ct.giaBan      = t.gia;
                    cthdb.themCTHDN(ct);
                }
            }
            Session["giohang"] = null;
            return(Redirect("~/Home/Index"));
        }
Пример #2
0
        public ActionResult addHDB(string aoe, string aMHDB, string atenTk, string angay)
        {
            HoaDonBan dt = new HoaDonBan();

            dt.maHoaDonBan = aMHDB;
            dt.tenTk       = atenTk;
            dt.ngayBan     = angay;
            if (aoe == "1")
            {
                hdb.themHDB(dt);
            }
            else
            {
                hdb.suaHDB(dt);
            }

            return(Redirect("~/Admin/HoaDonBan"));
        }