public async Task <IActionResult> PersonalInfo(int iPageId) { int iUserId = Convert.ToInt32(User.Claims.FirstOrDefault(x => x.Type == "Id")?.Value); if (iUserId > 0) { UserInfo entityUserInfo = await _userInfoService.GetUserInfoAsync(new UserInfo() { Id = iUserId }); if (entityUserInfo != null) { PersonalInfo entityPersonalInfo = new PersonalInfo(); entityPersonalInfo.SloginName = entityUserInfo.SloginName; entityPersonalInfo.SuserName = entityUserInfo.SuserName; entityPersonalInfo.SuserEmail = entityUserInfo.SuserEmail; entityPersonalInfo.SuserPhone = entityUserInfo.SuserPhone; if (entityUserInfo.IfileInfoId > 0) { UploadFileInfo entityUploadFileInfo = await _uploadFileInfoService.GetFileInfoAsync(entityUserInfo.IfileInfoId); entityPersonalInfo.Uid = entityUploadFileInfo.Uid; entityPersonalInfo.sAvatar = string.IsNullOrWhiteSpace(entityUploadFileInfo.SrelativePath) ? "/Images/login_tx.jpg" : entityUploadFileInfo.SrelativePath; } else { entityPersonalInfo.sAvatar = "/Images/login_tx.jpg"; } return(base.Empty(iPageId, entityPersonalInfo)); } } return(base.Empty(iPageId)); }
public async Task <IActionResult> IndexAsync() { int iUserId = Convert.ToInt32(User.Claims.FirstOrDefault(x => x.Type == "Id")?.Value); UserInfo entityUserInfo = await _UserInfoService.GetUserInfoAsync(new UserInfo() { Id = iUserId }); if (entityUserInfo != null) { UploadFileInfo entityUploadFileInfo = await _uploadFileInfoService.GetFileInfoAsync(entityUserInfo.IfileInfoId); ViewData["SuserName"] = entityUserInfo.SuserName; if (entityUploadFileInfo != null) { ViewData["Avatar"] = entityUploadFileInfo.SrelativePath; } else { ViewData["Avatar"] = "/Images/DefaultUserHeadImage.jpg"; } } return(View()); }