41 Replies
So I am making login signup my signup page is working perfectly but how can write logic of Login page Without Linq methods if they are not working or how to use them why method like FirstOrDefault or Where() are not working in my code
Define "not working"
!
see this is a class task and I am writing code by seeing my old project
see I want something like that to get login functionality
but it is not working
What exactly is it doing, which makes you think that it isn't working?
it highlight its with a red line
and also
not show me this in intelllisense
Right, and what is the error message it shows in the "Error List" pane?

("Not working" there could have meant that the code ran but always returned "Incorrect Username or Password" -- that's what I assumed you meant. You need to be precise when talking to other people)
Can you paste the definition of
ApplicationDbContext
? _context.tbl_Customer
should not be an instance of ApplicationDbContext
_context
should be the ApplicationDbContext
here, and tbl_Customer
(as bad of a name as it is) should be a DbSet<Customer>
Sorry I don't have a strong vocabulary like you in english
see i have declare it like this
but it is also not getting in controller part
Paste the whole class, please. I want to see what
tbl_Customer
isforget tbl_Customer i was just trying to copy my old project which was similar to this in that project i named
tbl_Customer
in my new project it is names
as
customer.cs
and here is my ApplicationDbContext.cs
@canton7I'm confused as to why the compiler didn't throw an error saying that
_context.tbl_Customer
doesn't exist, then
You need _context.customers.FirstOrDefault(x => x.email == ...)
of coursedon't mix
tbl_Customer
What do you mean?
because I am telling you 2nd time that I want it to create like that
this tbl_Customer
is my old project
having this model
classs
this is the part of new one
I don't understand. Your
ApplicationDbContext
has DbSet<customer> customers { get; set; }
. You pasted that code above. That means you need to use _context.customers
yes
i want to _context.customers table
_context.customer.FirstOrDefault(c => c.id = id);
Yes. Do that.
yes but the thing is when i write this line it gives me this error
What error?
see attachment
Which attachment?
Last time, you showed code which used
_context.tbl_Customer
, which is wrong
see
Show the code above that error
can you come on vc so i can share my
screeen and
No, I'm at work
betterunderstand
ok!
'

see
That's a completely different error to this one: https://discord.com/channels/143867839282020352/1354050482196189184/1354059345826021398
Technical Developer
Quoted by
<@660066004059029524> from #FirstOrDefault and other methods are not working in LINQ (click here)

React with ❌ to remove this embed.
You need
public DbSet<customer> customers { get; set; }
it is now
giving me this error
see
You need
public DbSet<customer> customers { get; set; }
i have already written here `DbSet<customer> customers {get ; set}
You need
public DbSet<customer> customers { get; set; }
this property
is already
mentioned
if you see my dbContext clas
Please read what I wrote very carefully
public
DbSet<customer> customers { get; set; }
ok
when
i clean the solution
and rebuild after adding
public
it now finally works
thanks