• 1


    public object GetInfoByUserName(dynamic parameters)
    {

    try
    {
    List<UserInfo> listInfo = new List<UserInfo>();
    listInfo.Add(new UserInfo { UserID = 1, UserName = "张三1", Tel = "13333333333", Address = "beijing1" });
    listInfo.Add(new UserInfo { UserID = 2, UserName = "张三2", Tel = "23333333333", Address = "beijing2" });
    listInfo.Add(new UserInfo { UserID = 3, UserName = "张三3", Tel = "33333333333", Address = "beijing3" });
    listInfo.Add(new UserInfo { UserID = 4, UserName = "张三4", Tel = "43333333333", Address = "beijing4" });
    listInfo.Add(new UserInfo { UserID = 5, UserName = "张三5", Tel = "53333333333", Address = "beijing5" });

    if (parameters == null)
    {
    return new ResultData<string>() { ResultFlag = 0, ResultCode = "0001", ResultMsg = "请求参数参数为空", ResultDatas = "" };
    }

    string temUserName=parameters.UserName;
    UserInfo temInfo = listInfo.Where(x => x.UserName.Equals(temUserName.Trim())).FirstOrDefault();

    return new ResultData<UserInfo>() { ResultFlag = 1, ResultCode = "0002", ResultMsg = "", ResultDatas = temInfo };
    }
    catch (Exception ex)
    {
    string errorMsg = string.Format("参考数据:{0},异常消息:{1},异常代码{2}",parameters,ex.Message,ex.StackTrace);
    LogHelper.Error(errorMsg);
    return new ResultData<string>() { ResultFlag = 0, ResultCode = "0003", ResultMsg = "操作失败", ResultDatas = "" };
    }
    }

  • 相关阅读:
    leetcode——448.找到所有数组中消失的数字
    leetcode——268.缺失数字
    leetcode——680.验证回文字符串2
    leetcode——125.验证回文串
    leetcode——217.存在重复元素
    leetcode——189.旋转数组
    02-04 线性回归
    02-03 感知机对偶形式(鸢尾花分类)
    02-02 感知机原始形式(鸢尾花分类)
    02-01 感知机
  • 原文地址:https://www.cnblogs.com/muxueyuan/p/7347090.html
Copyright © 2020-2023  润新知