I am very new to the Entity Framework Core and working with SQL
I have created a table called 'User' in a database and everytime I a new user is created, a new Id is also generated since it is a primary key. I want to be able save the users Id when they login, so that if they add a new workout to the workout table, then it will be saved with their Id.
I have tried:
foreach (var field in data)
{
if (context.User.Any(user => user.Name == UserName && user.Password == PassWord))
{
int UserID = context.User.Any(user => user.Id = UserID);
}
But I still don't exactly know how the queries work
Please help me.