On this part, you are going to learn how to render a UI based on the user role.
So Visual Studio, we're going to start with the navigation bar, and if the user is not signed in and
is not an administrator, we are not going to display this section where they can add actors, they
can add producers, etc. So Newland has got to shared and then go to the layout, the C-sharp HDMI port,
then your little scroll down.
And here we have the management dropdown Indian management job we are going to have.
But if conditions are if.
The user that identity that is authenticated and also the same user user that is enrolled at admin.
Then we are going to display the Management Navigation Bar dropdown, so let us just copy this part,
actually, let us cut this part and paste it inside here.
Let us also go to the movie card, so for that, I'll just go to the Solution Explorer and then in your
go to movies and then index that C-sharp HDMI out and then in here you are going to see that we have
for the movies, the added icon.
And this icon needs to also be rendered only if a user is an admin Sonja type.
If.
The user that identity that is authenticated and also the user that is in a role admin.
There we are going to display this button.
Then let us copy this Line Control, see?
Now let us go to the other features like, for example, the actors and then in here go to the index
dusty shop HMO and for the actions.
And here.
We're going to add the if condition good to have the actions that's causing this part can't remove the
extra space and then go to the action buttons.
We're going to add this same condition in here as well.
This.
Cut and then pasted in here, just copy this section and now let us go to the cinemas.
Index.
And we in here then scroll down to the actions themselves.
And then curly bracket.
Then a little scroll down to the producers.
I'm on the index file.
And then let us do the same for the double header.
And also, the action buttons sign here to peace and then add the closing curly bracket.
Now let us go to the Solution Expo one more time and I'll scroll down in here and I don't think we have
forgotten anything.
We're going to work with the orders on the next part.
So they'll just grow up.
Let us go to the details for the actors.
And if you scroll down in here, you are going to see that you have the added bottom line here is I
had a condition.
Let's go to the cinemas details of you.
Scroll down.
Let's edit for this edit button.
Then let us go to the details for the movie.
Scroll down in here.
And you can see that we do not have any update or a button just to add to shopping cart and the index.
Has got the solution explorer.
Go to the details for the producer.
But in here at the condition in here as well.
Now, let us see all the changes and run this project.
So now here you can see that the management option up here is missing because we are not logged in as
an administrator.
And if you go, for example, to show the movie details, you can see that in here.
You have, for example, the cinema.
And if you go to the cinema details, you just have these shall all option, but the added option is
missing.
Now let us click the show.
All.
And you can see that we have only three columns now, the actions is missing because we are not logged
in as an administrator.
If you go now in year to the producers, you're going to see that you do not have the actions.
The same goes for the actors.
Etc..
But the only thing that we are seeing in here is that you still have the option to add a new actor to
add a new movie, etc. and that can be done just by the administrator.
So let us go to the new button partial view and your go to the Solution Explorer.
Scroll down and then go to the create item that C-sharp HDMI out.
And then in the same way, we are going to check for the user identities.
If the user identity is authenticated.
And the user that is enrolled at MIT.
Then we want to show the create bottlenecks of Control X and then base it in here.
Now let us save all the changes and restart this project.
Now, when you can say that we do not have the aid I cut, and if you go for example to the details
and then you go to the producers, the icon is missing in here as well.
Now let us log in as an administrator and the email address is admin at e-tickets dot com.
The best one is calling at one two three four question mark and then click the login button now that
you are logged in as an administrator.
You can see that you have the management section, you have the add new button.
And if you go, for example, to show the details and then go to cinema, you can see that you also
have the added button for the cinema.
And if you go, for example, to producers.
You have the new and you have the actions.
And if you go to the actors, you also have the actions and the add new button in here.
You have hello admin user because that is your username and the log out button.
Not let us click on this button and on the next part, they're going to work on the orders.
So in the user section, we are going to display the user name of the buyer.