asp.net mvc - Best way to let Admin create User in ASP MVC -
in visual studio 2013 have created mvc project individual account (asp net identity 2.x).
so @ url account/register (anonymous) user can sign up.
now want admin user can create user (and in view there additional fields respect register view).
what's best way accomplish this? use same route , view (account/register) show field in view according role of user? or create route/controller/view admin?
i think best ways is:
create admincontrooler in asp mvc or webapi (if any) , there write method user role admin.
like:
[authorize(roles = "admin")] public class admincontroller : apicontroller { [httppost] public void createuser(userviewmodel model) { ... logic } }
this best practice because if need add few new methods user-admin only, add in controller
Comments
Post a Comment