On this part, you are going to learn how to list all the users that have signed up in your application.
So for that then does go to Visual Studio.
And you go to the account controller and the account controller, we are going to create a new action.
So just before the log in, I'm going to type in your public action result and of the action name is
going to be users.
Then you're going to get all the users from the database.
For that, I'll just type VAR users.
Is equal to underscore context that users and then to list and if you want, we can use the two least
async method.
So let us import the namespace for the tools they sing.
That is the micro so that any different, more core than you are going to have a weight and that in
front of the action resulted in us at a sink and then task.
And then we have the result then down here we are just going to return to the view.
All.
The users.
Now, this view is going to be called or is going to be rendered only by the administrators so that
I'll see the change in here and I'll let us go to the Solution Explorer.
Then here got to views and then share, then go to the identity dot c-sharp each demo and that scroll
down.
And then in here after the orders, we are going to have the users and the users.
We're going to call the controller account.
The action is going to be the users and the text is going to be users.
The icon is going to be by them, by people.
Now the users option, we have said that is going to be available just to the administrators.
So let us add an if checking here.
So if the user is in role and then admit that inside here we are going to have.
The list item for the users.
But that's just sitting here and scroll down.
Remove the extra space, save all the changes and run this project.
Now, Nir, let us log in as a normal user.
So we are successfully logged in to our Airbnb, let us go to the helo and then hear the username,
and you can see that you can only get the orders.
Orders, but you do not have the option for the users.
Now let us look out and then log in as an administrator.
Hello.
The username, you can see that we have the orders and users.
Now when you go to the users, we can see that we get an exception.
And that's right, because we didn't create the user's view yet.
So let us just close the browser and down here, let us go to the Solution Explorer and then here go
to the account folder.
And inside this folder, we are going to add the users view and you're just A. The view name is going
to be users and then click the add button.
Now let us go to any of our sections of, for example, the actors and then go to the index, then control
it, control.
See, thank God users and just it in here, but us remove this part.
We do not need to create anything in here.
Now let us scroll up.
This is going to be innumerable of users application user.
Then this is going to be a list of all users.
And in Europe down here we are going to have a display name for the full name.
We are going to have the second one for the user name and the third one is going to be for the email
address.
And then if you want, you can also use the other properties.
But these are the only properties that we are currently storing values in the database and down here.
We have waited for the full name.
Another one will be used for the username.
And the last one for the email address, so email.
Just the email, probably now let us remove this part of the code.
And now if you scroll up.
You because we have only three columns.
And if you want, you can change the M.D. from eight to six, but now you need to also change the offset
to be, let's see, three.
You're going to have three on the left, three on the right and six in the middle.
And then inside here you can add a p p tag and inside the p tag, you're going to have an H for tag,
which says least of all users.
And then down here, we have the table and we have the data.
Let us now see all the changes and run this project.
And now, if you go to the administrator profile, you are going to see that you also have the users.
So let us click on the users.
And these are all the users that you have in your application.