Welcome to the FoxLearn
Today we will learn how to add user to role with ASP.Net identity
Now, We will modify register form allows you to create a new user, then assign the user to roles
We will get roles from role table, then add to the list of SelectListItem
You can use ViewBag to store list of SelectListItem
The ViewBag property enables you to dynamically share values from the controller to the view
It is a dynamic object which means it has no pre-defined properties
You define the properties you want the ViewBag to have by simply adding them to the property
In the view, you retrieve those values by using same name for the property.
You need to add a RoleName property to RegisterViewModel
This property is used to get the selected value from the DropDownList
You need to add a DropDownList to the register view
Thank you for watching this video