public ActionResult UpdateUser(USSER user)
        {
            Shopbanhang db = new Shopbanhang();

            if (ModelState.IsValid)
            {
                try
                {
                    var edituser = db.USSERs.Find(user.ID);
                    edituser.USERNAME      = user.USERNAME;
                    edituser.NAME          = user.NAME;
                    edituser.ADDRESS       = user.ADDRESS;
                    edituser.EMAIL         = user.EMAIL;
                    edituser.PHONE         = user.PHONE;
                    edituser.MODDIFIEDDATE = DateTime.Now;
                    edituser.CREATEBY      = "User";
                    db.SaveChanges();
                    return(View("EditUser"));
                }
                catch
                {
                    ModelState.AddModelError("", "Cập nhật user không thành công");
                }
            }
            return(View("EditUser"));
        }
        public IQueryable <USSER> Gettenkh(long makh)
        {
            Shopbanhang        db       = new Shopbanhang();
            IQueryable <USSER> tenkhach = db.USSERs;

            tenkhach = from p in tenkhach where p.ID == makh select p;
            return(tenkhach);
        }
        public ActionResult EditUser()
        {
            Shopbanhang db = new Shopbanhang();

            if (Session.Count > 0)
            {
                var userid = (Userlogin)Session[Commonconst.USER_SESSION];
                var id     = userid.UserId;
                var user   = db.USSERs.Find(id);
                return(View(user));
            }
            return(RedirectToAction("Login", "User"));
        }
Beispiel #4
0
        public ActionResult GetData()
        {
            Shopbanhang db        = new Shopbanhang();
            int         ThanhCong = db.DONHANGs.Where(x => x.TINHTRANGDH == 3).Count();
            int         DonMoi    = db.DONHANGs.Where(x => x.TINHTRANGDH == 1).Count();
            int         DangGiao  = db.DONHANGs.Where(x => x.TINHTRANGDH == 2).Count();
            int         Bihuy     = db.DONHANGs.Where(x => x.TINHTRANGDH == 4).Count();
            Ratio       tt        = new Ratio();

            tt.ThanhCong = ThanhCong;
            tt.BiHuy     = Bihuy;
            tt.DangGiao  = DangGiao;
            tt.DonMoi    = DonMoi;
            return(Json(tt, JsonRequestBehavior.AllowGet));
        }