Example #1
0
        /// <summary>
        /// 更新用户
        /// </summary>
        /// <param name="updateType">更新类型,1-新增,2-修改,3-删除</param>
        /// <param name="id">用户ID</param>
        /// <returns></returns>
        public ActionResult UpdateUser(string updateType, string id)
        {
            UserRegister data = new UserRegister();

            if (string.IsNullOrEmpty(updateType))
            {
                updateType = "1";
            }

            switch (updateType)
            {
            case "1":
                break;

            case "2":
                UserDbContext uc1 = new UserDbContext("ConnStr1");
                data = (UserRegister)uc1.GetUsersByID(id);
                break;

            case "3":
                UserDbContext uc2 = new UserDbContext("ConnStr1");
                data = (UserRegister)uc2.GetUsersByID(id);
                break;

            default:
                throw new Exception("更新类型出错。");
            }

            if (data == null)
            {
                data = new UserRegister();
            }

            return(View(data));
        }