I am trying to make an ebank, for myself, so it is not that serious. This is my structure:

What I achieved so far: if a user logs in, and click on the Ebank actionlink, for him/her I display ALL of the data (I mean if logged in userId==1 I display all of the data with userId==2 too, this is what I want to change).
public ActionResult Index()
{
var bankaccounts = db.BankAccounts.Include(b => b.Type).Include(b => b.Balance).Include(b => b.UserProfile);
return View(bankaccounts.ToList());
}
This "var bankaccounts" row is what I have to change if I am right. If I put a breakpoint to the "return view(bankaccounts.ToList())" row I get the following data from the "bankaccounts":
{
SELECT
[Extent1].[BankAccountId] AS [BankAccountId],
[Extent1].[UserId] AS [UserId],
[Extent1].[AccountName] AS [AccountName],
[Extent1].[AccountType] AS [AccountType],
[Extent1].[AccountNumber] AS [AccountNumber],
[Extent1].[AccountStatus] AS [AccountStatus],
[Extent1].[AccountAvaiability] AS [AccountAvaiability],
[Extent2].[AccountType] AS [AccountType1],
[Extent2].[TypeName] AS [TypeName],
[Extent3].[BalanceId] AS [BalanceId],
[Extent3].[BalanceAmount] AS [BalanceAmount],
[Extent3].[TrustAmount] AS [TrustAmount],
[Extent4].[UserId] AS [UserId1],
[Extent4].[UserName] AS [UserName]
FROM [dbo].[BankAccount] AS [Extent1]
INNER JOIN [dbo].[Type] AS [Extent2] ON [Extent1].[AccountType] = [Extent2].[AccountType]
LEFT OUTER JOIN [dbo].[Balance] AS [Extent3] ON [Extent1].[BankAccountId] = [Extent3].[BalanceId]
INNER JOIN [dbo].[UserProfile] AS [Extent4] ON [Extent1].[UserId] = [Extent4].[UserId]}
Questions:
I cannot find any real sql command in the code(its auto generated by mvc), so If I am right
- does this "var bankaccounts" row do the sql select?
- If yes, how?
- Where can I read after this type of programming?
- I want to change this code to something like "select ... where userid == websecurity. CurrentUserId", can you help me with this please?
- Any more ideas, advices that I should take or read after? The more you say the more I can learn!
DBQuery. checkout this -> msdn.microsoft.com/en-us/data/jj592907.aspx