Leo
Leo

Reputation: 160

Create UI in MVC 5 to manage OWIN roles

In visual studio 2013, the newly create MVC 5 project with individual authentication includes the sample code to create user through OWIN, but there is no sample code to create role and assign role to user.

Anybody knows how to build UI, including models, views and controllers, to manage OWIN roles (AspNetRoles) and user roles(AspNetUserRoles) in MVC 5?

Upvotes: 1

Views: 2903

Answers (2)

William Ballesteros
William Ballesteros

Reputation: 1011

If you want to manage the AspNetUsersRoles, you must make the following modification.

1. Remove the primary key, actually is conformed by UserId and RoleId

2. Add a new Id field in the table and check like primary key.

3. Update your model.

enter image description here

Now you can scaffolding this entities and create the controllers and the views.

Upvotes: 0

Brock Allen
Brock Allen

Reputation: 7435

A new OSS project was just released that is meant to help you with this:

http://brockallen.com/2014/04/09/introducing-thinktecture-identitymanager/

Upvotes: 1

Related Questions