public JsonResult AddUser(string orgCode, string userId, string userName, string password)
        {
            var check = _userRepository.GetUserBySpecifiedCondition(userId);

            if (check.Count() > 1)
            {
                return Json(new { result = false, msg = "添加失败,已存在相同的用户账号!" }, JsonRequestBehavior.AllowGet);
            }

            var org = new t_user()
            {
                orgcode = orgCode,
                userid = userId,
                name = userName,
                password = password

            };

            try
            {
                var result = _userRepository.AddUser(org);
                if (result)
                {
                    return Json(new { result = true, msg = "" }, JsonRequestBehavior.AllowGet);
                }
                else
                {
                    return Json(new { result = false, msg = "操作失败!" }, JsonRequestBehavior.AllowGet);
                }
            }
            catch (Exception ex)
            {
                return Json(new { result = false, msg = ex.Message }, JsonRequestBehavior.AllowGet);
            }
        }
        public bool ModifyUser(t_user user)
        {
            dbContext.t_user.Attach(user);

            var stateEntry = ((IObjectContextAdapter)dbContext).ObjectContext.
               ObjectStateManager.GetObjectStateEntry(user);

            stateEntry.SetModifiedProperty("name");
            stateEntry.SetModifiedProperty("password");

            // dbContext.Entry<t_user>(user).State = EntityState.Modified;

            return dbContext.SaveChanges() > 0;
        }
        public bool AddUser(t_user user)
        {
            dbContext.Entry<t_user>(user).State = EntityState.Added;

            return dbContext.SaveChanges() > 0;
        }
        public JsonResult ModifyUser(string userId, string userName, string password)
        {
            var org = new t_user()
            {
                userid = userId,
                name = userName,
                password = password

            };

            try
            {
                var result = _userRepository.ModifyUser(org);
                if (result)
                {
                    return Json(new { result = true, msg = "" }, JsonRequestBehavior.AllowGet);
                }
                else
                {
                    return Json(new { result = false, msg = "操作失败!" }, JsonRequestBehavior.AllowGet);
                }
            }
            catch (Exception ex)
            {
                return Json(new { result = false, msg = ex.Message }, JsonRequestBehavior.AllowGet);
            }
        }