public CurrentUser GetCurrentUser(CurrentUserRequest request) { var currentUser = _cacheManager.GetCachedCurrentUser(request.Email); if (currentUser == null) { throw new ApplicationException("Current user not mapped!"); } return(currentUser); }
public async Task <bool> Handle(CurrentUserRequest message, IOutputPort <CurrentUserResponse> outputPort) { var user = await _userRepository.FindByName(message.UserName); if (user == null) { outputPort.Handle(new CurrentUserResponse(new[] { "User Profile Not Found" }, false)); } outputPort.Handle(new CurrentUserResponse(user.UserProfileImages, user.Email, user.FirstName, user.LastName, true)); return(true); }
public async Task <bool> Handle(CurrentUserRequest request, IOutputPort <CurrentUserResponse> outputPort) { if (!string.IsNullOrWhiteSpace(request.UserName)) { var user = await _userRepository.FindByName(request.UserName); if (user != null) { outputPort.Handle(new CurrentUserResponse(user, true, null)); return(true); } } outputPort.Handle(new CurrentUserResponse(new[] { new Error("Error Occur", "No user found") })); return(false); }
public User Get(CurrentUserRequest request) { IAuthSession session = this.GetSession(); return Repository.GetByEmail(session.ProviderOAuthAccess[0].Email); }
public static CurrentUserRequest GetCurrentUserRequest() { var request = new CurrentUserRequest(EmailOne); return(request); }
} //Injected by IOC public User Get(CurrentUserRequest request) { IAuthSession session = this.GetSession(); return(Repository.GetByEmail(session.ProviderOAuthAccess[0].Email)); }