asp.net identity - How to display aspnetuser data on a profile page? -
i working mvc 5 identity. display data aspnetuser table in users profile page. how can so, have tried far. in profile controller
public actionresult viewprofile(string id) { var user = db.users.single(u => u.username == id); return view(user); }
my view
@model carpool.models.applicationuser @{ viewbag.title = "viewprofile"; } <h2>viewprofile</h2> <div> <h4>applicationuser</h4> <hr /> <dl class="dl-horizontal"> <dt> @html.displaynamefor(model => model.nationality) </dt> <dd> @html.displayfor(model => model.nationality) </dd> <dt> @html.displaynamefor(model => model.email) </dt> <dd> @html.displayfor(model => model.email) </dd>
in layout page
<li>@html.actionlink("profile", "viewprofile", new { id = user.identity.name })</li>
wiki
Comments
Post a Comment