Example #1
0
        public async Task <UserInfoResponse> AlterUserInfo([FromBody] Users body)
        {
            UserInfoResponse response = new UserInfoResponse();

            if (body.UserName == "")
            {
                response.ReplyMsg = "请填写您的用户名";
                return(response);
            }
            else if (body.Sex == "")
            {
                response.ReplyMsg = "请填写您的性别";
                return(response);
            }
            else if (body.PhoneNum == "")
            {
                response.ReplyMsg = "请填写您的电话号码";
                return(response);
            }
            else if (body.Address == "")
            {
                response.ReplyMsg = "请填写您的收件地址";
                return(response);
            }
            else if (body.PostalCode == "")
            {
                response.ReplyMsg = "请填写您的邮政编码";
                return(response);
            }
            else
            {
                var count = await information.AlterUserInfo(body);

                if (count > 0)
                {
                    response.ReplyMsg = "用户信息编辑成功";
                }
                else if (count == 0)
                {
                    response.ReplyMsg = "尚未修改任何信息";
                }
                else
                {
                    response.ReplyMsg = "用户信息编辑失败";
                }
                return(response);
            }
        }