public virtual ActionResult Create(UserView editUser)
        {
            if (ModelState.IsValid) {

                var newuser = new User();
                TryUpdateModel(newuser);
                Repository.Add(newuser);
                Repository.Save();
                if (Request.IsAjaxRequest())
                {
                    return Content("用户已添加成功");
                }
                return RedirectToAction("Index");
            }
            if (Request.IsAjaxRequest())
            {
                return Content("用户不能添加");
            }
            return View(new UserView());
        }
        private void FixupUser(User previousValue)
        {
            if (previousValue != null && previousValue.FlowLogs.Contains(this))
            {
                previousValue.FlowLogs.Remove(this);
            }

            if (User != null)
            {
                if (!User.FlowLogs.Contains(this))
                {
                    User.FlowLogs.Add(this);
                }
                if (TodoBy != User.UserId)
                {
                    TodoBy = User.UserId;
                }
            }
            else if (!_settingFK)
            {
                TodoBy = null;
            }
        }
        private void FixupToUser(User previousValue)
        {
            if (previousValue != null && previousValue.RecievedMessages.Contains(this))
            {
                previousValue.RecievedMessages.Remove(this);
            }

            if (ToUser != null)
            {
                if (!ToUser.RecievedMessages.Contains(this))
                {
                    ToUser.RecievedMessages.Add(this);
                }
                if (ToUserId != ToUser.UserId)
                {
                    ToUserId = ToUser.UserId;
                }
            }
            else if (!_settingFK)
            {
                ToUserId = null;
            }
        }
        private void FixupFromUser(User previousValue)
        {
            if (previousValue != null && previousValue.SentMessages.Contains(this))
            {
                previousValue.SentMessages.Remove(this);
            }

            if (FromUser != null)
            {
                if (!FromUser.SentMessages.Contains(this))
                {
                    FromUser.SentMessages.Add(this);
                }
                if (FromUserId != FromUser.UserId)
                {
                    FromUserId = FromUser.UserId;
                }
            }
        }