public IActionResult ViewProfile(int id) { var user = userService.Get(id); if (user == null) { return(NotFoundView()); } var model = mapper.Map <UserModel>(user); if (currentUser.IsAuthenticated) { model.FriendRequestSent = friendService.FriendRequestSent(currentUser.Id, model.Id); model.Friends = friendService.AreFriends(user, currentUser.Id); } model.CanSeeProfile = user.Privacy == false || model.Friends || model.Id == currentUser.Id || currentUser.CanViewProfile; return(View(model)); }