Question:
I am new one at that type development and I’m wondering how can I get related data.I have 2 tables
AspNetUsers
and Accounts
. In Accounts
table there are only 3 columns Id
, UserId
join AspNetUsers
table, and Amount
. So, what I want to do, is just get this account information for current logged in user.I was trying something that I have found in documentation, it works, but shows strange result:
Index.cshtml
:Index.cshtml.cs
:account
, but on page it shows like this:Answer:
DisplayNameFor
displays name for the model (also your value is in account.Amount
, not just account
).Just change to:
If you have better answer, please add a comment about this, thank you!