Exemplo n.º 1
0
        public JsonResult signUp(string username, string password, string name, int gender, string address, string phone, string email)
        {
            ToysDBContext db  = new ToysDBContext();
            int           ret = -1;

            user user = new user();

            user.address    = address;
            user.email      = email;
            user.username   = username;
            user.gender     = gender;
            user.fullname   = name;
            user.password   = Encryptor.MD5Hash(password);
            user.permission = 0;
            user.phone      = phone;

            db.users.Add(user);
            int stt = db.SaveChanges();

            if (stt > 0)
            {
                ret = 1;
            }
            return(Json(new
            {
                ret //ok
            }, JsonRequestBehavior.AllowGet));;
        }
Exemplo n.º 2
0
        public ActionResult pay(bill ttKhachHang)
        {
            ttKhachHang.create_date = DateTime.Now.Date;
            db = new ToysDBContext();
            db.bills.Add(ttKhachHang);


            cart cart = (cart)Session["cart"];

            foreach (CartItem item in cart.lstcart)
            {
                bill_detail detail = new bill_detail();
                detail.bill_id    = ttKhachHang.id;
                detail.product_id = item.Id_Product;
                detail.amount     = item.Amount;
                detail.price      = item.Amount * item.price;
                db.bill_detail.Add(detail);
            }

            int    stt     = db.SaveChanges();
            string message = "Có lỗi khi đặt hàng!";            if (stt > 0)

            {
                message = "Đặt hàng thành công";
            }
            Session["message"] = message;
            Session["Cart"]    = null;

            return(RedirectToAction("Index", "Home"));
        }
Exemplo n.º 3
0
 public ManufacturerDAO()
 {
     db = new ToysDBContext();
 }
Exemplo n.º 4
0
 public CategoryDAO()
 {
     db = new ToysDBContext();
 }
Exemplo n.º 5
0
 public ProductDAO()
 {
     db = new ToysDBContext();
 }
Exemplo n.º 6
0
 public SlideDAO()
 {
     db = new ToysDBContext();
 }
Exemplo n.º 7
0
 public BillDetailDAO()
 {
     db = new ToysDBContext();
 }
Exemplo n.º 8
0
 public UserModel()
 {
     context = new ToysDBContext();
 }
Exemplo n.º 9
0
 public CategoryModel()
 {
     context = new ToysDBContext();
 }
Exemplo n.º 10
0
 public UserDAO()
 {
     db = new ToysDBContext();
 }