public ActionResult register(A_UserLogin emp)
        {
            LaTuErEntities db = new LaTuErEntities();

            db.A_UserLogin.Add(emp);
            int rs = db.SaveChanges();

            if (emp != null)
            {
                return(RedirectToAction("Login", "Login"));
            }
            return(RedirectToAction("register"));
        }
Exemplo n.º 2
0
        public ActionResult Login(string txt_id, string txt_pwd)
        {
            LaTuErEntities db  = new LaTuErEntities();
            var            emp = db.A_UserLogin
                                 .Where(c => c.UserPhone == txt_id && c.UserPwd == txt_pwd)
                                 .FirstOrDefault();

            if (emp != null)
            {
                Session["UserId"] = emp.UserId; //保存用户ID
                return(RedirectToAction("Index", "Home"));
            }
            return(RedirectToAction("Login"));
        }
Exemplo n.º 3
0
        public JsonResult Load()
        {
            //查询商品
            LaTuErEntities db   = new LaTuErEntities();
            var            list = db.E_Commodity.ToList()
                                  .Select(c => new
            {
                CommodityId             = c.CommodityId,
                Tradename               = c.Tradename,
                Price                   = c.Price,
                Image                   = c.Image,
                Commodityclassification = c.Commodityclassification,
                Contactnumber           = c.Contactnumber,
            }).ToList();

            return(Json(list, JsonRequestBehavior.AllowGet));
        }
        public JsonResult UserOrder()
        {
            int            UserID = Convert.ToInt32(Session["UserID"]);
            LaTuErEntities db     = new LaTuErEntities();
            var            list   = from p in db.J_OrderXX
                                    join s in db.E_Commodity
                                    on p.CommodityId equals s.CommodityId
                                    where p.UserId == UserID
                                    select new
            {
                p.OrderId,
                s.Tradename,
                s.Price,
                s.Image
            };

            return(Json(list, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 5
0
        /// <summary>
        /// 商品详情
        /// </summary>
        /// <returns></returns>
        public JsonResult Load()
        {
            int            id   = Convert.ToInt32(TempData["id"]);
            LaTuErEntities db   = new LaTuErEntities();
            var            list = from p in db.E_Commodity
                                  join s in db.F_Commoditypictures
                                  on p.CommodityId equals s.CommodityId
                                  where p.CommodityId == id
                                  select new
            {
                CommodityId          = p.CommodityId,
                Tradename            = p.Tradename,
                Price                = p.Price,
                CommodityDescription = p.CommodityDescription,
                Mastergraph          = s.Mastergraph
            };

            return(Json(list, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 6
0
        public JsonResult Add(int id, int count)
        {
            int            UserID = Convert.ToInt32(Session["UserID"]);
            LaTuErEntities db     = new LaTuErEntities();
            var            cart   = new ShoppingCart
            {
                UserId                = UserID,
                CommodityId           = id,
                Quantityofcommodities = count
            };

            db.ShoppingCarts.Add(cart);
            int rs  = db.SaveChanges();
            var obj = new { msg = "添加失败", code = 201 };

            if (rs > 0)
            {
                obj = new { msg = "添加成功", code = 200 };
            }
            return(Json(obj));
        }
        public JsonResult Load()
        {
            //订单
            LaTuErEntities db   = new LaTuErEntities();
            var            list = db.J_OrderXX.ToList()
                                  .Select(c => new
            {
                OrderxxId             = c.OrderId,
                CommodityId           = c.A_UserLogin.UserName,
                Tradename             = c.Tradename,
                Ordertime             = DateTime.Now.ToString("yyyy-MM-dd"),
                PaymentmethodId       = c.PaymentmethodId,
                Itempricing           = c.Itempricing,
                Commoditypictures     = c.Commoditypictures,
                UserId                = c.UserId,
                Quantityofcommodities = c.Quantityofcommodities,
                Orderstatus           = c.Orderstatus,
                OrderId               = c.OrderId
            }).ToList();

            return(Json(list, JsonRequestBehavior.AllowGet));
        }