On this part, we are going to modify the identity partial view, so only the bottlenecks necessary
will show up in the navigation bar.
So for example, if you are not logged in in this app, then the log in and the register button will
show up.
If you are logged in, then the profile section and the log out buttons.
So for that, let us go to Visual Studio and see it in action.
And you go to the identity portal view and then I'll scroll up here.
Then in here, I'm going to tie if the user and the user is coming from the Razer Beach beers, Razer,
ABC, ASP.NET Core, Microsoft.
And this is used for the current logged in user.
So we are going to check if we have a logged in user.
So if the user that identity that is authenticated, so if the user is authenticated.
Then we are going to display the user profile.
So we're going to have the profile dropdown and the logout buttons since we have these buttons in here,
then I'll just change the if in years, if the user is not authenticated, then we are going to display
the register and the logging patterns based.
I mean, here you can remove this ban otherwise or else that is that curly brackets, we're going to
have the rest of this code.
So let us select all this cult control x and then be it up here.
Now in the profile section, we have the Hello user.
Let us make this dynamic.
So basically we just get the user name of the logged in user.
For that, we need to inject the user manager and then appear at inject.
We're going to inject a service and that is going to be the user manager.
So user manager?
And the it is going to be the application user and the name is going to be the user manager.
Now the user manager doesn't work fine because it cannot find the namespace.
So from that, they'll just open that using and that Microsoft, not ASP.NET Core, that identity.
And now you can see that the air is gone now down here instead of the user.
We're going to have hello ads and we're going to get the user name of the logged in user.
And that is going to be user manager.
Not get username, so get username.
And we are going to get the username of the user.
Now, before you run this project, if you want to get rid of the using up here, you can just copy
this line or actually let us cut this line.
Then you go to the Solution Explorer in your go to the view imports.
And here you can just define all the imports that you're going to use throughout this app.
And then in here, you're going to have using Microsoft up East Peanut Corp identity.
You'll save the chains in here and then go to the identity part of you.
You're going to see that the air is gone.
Now let us start this project to see the result.
So now that we are not logged in, you can see that we have in here the log in and the register button
does got to register and then you'll just create another account.
So we know the email is going to be areas that you know the password coding at one two three four question
mark.
And coding at one two, three four question mark.
And then click the sign up button so you can see that the account was created successfully and that
has got to log in and your every set new dot com coding that one two three four question mark.
And here you can see that we still have you logging and the register buttons.
Now when you click log in, you're going to see that to get the hello, and then you have the username
and I'm next to the username, you have the log out button.
Now let us click the log button.
You could say that you were successfully lobbied hard because now here you have the logging and the
register button.