private async Task <FindUserResults> FindUser(Guid userId) { User dbUser = await _unitOfWork.Repository <User>().FindById(userId); var resultsObject = new FindUserResults(); resultsObject.Exists = dbUser != null; resultsObject.User = resultsObject.Exists ? dbUser : null; return(resultsObject); }
public async Task <ActionResult <UserViewModel> > GetUser(Guid id) { FindUserResults userSearch = await FindUser(id); if (!userSearch.Exists) { return(NotFound()); } var userToReturn = _mapper.Map <UserViewModel>(userSearch.User); return(Ok(userToReturn)); }