Beispiel #1
0
        public string SaveAddress([FromBody] QueryAdress query)
        {
            query.Ssid = query.Ssid.Substring(1, query.Ssid.Length - 2);
            var json = new UserLogin().SaveAddress(query);

            return(JsonConvert.SerializeObject(json));
        }
Beispiel #2
0
        public ResultModifyAddress SaveAddress(QueryAdress query)
        {
            var result = new ResultModifyAddress {
                Exception = new MyException()
            };

            try
            {
                var realSsid = new EncryDecry().Md5Decrypt(query.Ssid);
                var arr      = GetSession(realSsid);
                if (arr.Length < 3)
                {
                    result.Exception.Exmsg   = "not found";
                    result.Exception.Success = true;
                    return(result);
                }
                var findIt = _user.SearchUser(arr.GetValue(2).ToString());
                if (findIt == null)
                {
                    throw new NullReferenceException();
                }
                var info = _userInfo.GeTbUserInfos($"{findIt.Name}")?[0];
                if (info != null)
                {
                    info.Address = query.Address;
                    _userInfo.UpdateUserInfo(info);
                }
                result.Exception.Success = true;
            }
            catch (Exception ex)
            {
                AppLogger.Error($"{ex.Message} {ex.StackTrace}");
                result.Exception.Success = false;
            }
            return(result);
        }