Beispiel #1
0
        /// <summary>
        /// 添加或者编辑WebApi用户
        /// </summary>
        /// <param name="user">WebApi用户</param>
        /// <returns>返回添加或保存结果</returns>
        public Response CreateOrUpdate(User user)
        {
            return this.InvokeService(
                nameof(CreateOrUpdate),
                () =>
                {
                    this.Persistence.Update(NS, "CreateOrUpdate", user);

                    this.ClearCache<User>();
                },
                user);
        }
Beispiel #2
0
        public ActionResult CreateOrUpdate(User user)
        {
            if (user.IsValid())
            {
                if (user.Password != "******")
                {
                    user.ChangePassword = true;
                }

                user.Password = user.Password.MD5();

                var rsp = this.UserService.CreateOrUpdate(user);

                if (rsp.IsSuccess)
                {
                    return CloseDialogWithAlert("保存成功!");
                }
            }

            return Alert("添加失败!", AlertType.Error);
        }