Esempio n. 1
0
        public OperationResult Edit(EditUserRequest model)
        {
            using (var conn = this.OpenConnection())
            {
                string sql = @"
UPDATE TOP(1) [User]
SET Email=@Email, Nickname=@Nickname
WHERE ID=@ID
";

                var para = new
                {
                    ID = model.ID
                };

                var rows = conn.Execute(sql, para);

                if (rows > 0)
                {
                    return OperationResult.SuccessResult();
                }
                else
                {
                    return OperationResult.ErrorResult("不存在的用户");
                }
            }
        }
Esempio n. 2
0
        public IActionResult Edit(EditUserRequest model)
        {
            if (model == null)
            {
                return this.BadRequest();
            }

            var result = this.UserService.Edit(model);

            return this.ApiResponse(result);
        }
Esempio n. 3
0
        public IActionResult UpdateInfo(UpdateInfoRequest model)
        {
            if (model == null)
            {
                return this.BadRequest();
            }

            var request = new EditUserRequest
            {
                Email = model.Email,
                Nickname = model.Nickname,
                ID = this.SecurityManager.LoginUser.ID
            };

            var result = this.UserService.Edit(request);

            return this.ApiResponse(result);
        }