本文整理汇总了C#中UserService.QueryUserByMobileOrEmail方法的典型用法代码示例。如果您正苦于以下问题:C# UserService.QueryUserByMobileOrEmail方法的具体用法?C# UserService.QueryUserByMobileOrEmail怎么用?C# UserService.QueryUserByMobileOrEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserService
的用法示例。
在下文中一共展示了UserService.QueryUserByMobileOrEmail方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SearchUserInfo
public ActionResult SearchUserInfo(string searchStr)
{
AjaxResponse response = null;
try
{
var userService = new UserService();
var user = userService.QueryUserByMobileOrEmail(searchStr);
if (user == null)
{
response = new AjaxResponse(2, "用户不存在");
return this.Json(response);
}
var userAddressService = new UserReceiveAddressService();
var userDefaultAddress = userAddressService.QueryDefaultReceiveAddressByUserID(user.ID);
if (userDefaultAddress != null)
{
var addressModel = DataTransfer.Transfer<UserReceiveAddressModel>(
userDefaultAddress,
typeof(User_RecieveAddress));
addressModel.UserID = user.ID;
addressModel.UserName = user.Name;
response = new AjaxResponse(1, string.Empty, addressModel);
return this.Json(response);
}
else
{
var userModel = DataTransfer.Transfer<UserModel>(user, typeof(User));
response = new AjaxResponse(3, "没有地址信息", userModel);
return this.Json(response);
}
}
catch (Exception exception)
{
response = new AjaxResponse(-1, exception.Message);
return this.Json(response);
}
}