Database is not fetching data. Applied everything properly.

I am sending data from postman. Method is receiving data but when comparing data send by client and from data. It is not showing any data. See customer and card var. both are null. I don't know why data is not fetching from database. There is no any error.
No description
No description
35 Replies
Angius
Angius2w ago
You sure the customer with those values exists? .FirstOrDefaultAsync() returns null if there's no entry matching the predicate
Serene Sphinx
Serene SphinxOP2w ago
I have data in Database I am sending data through Postman which is available in Database.
Kringe
Kringe2w ago
Is account number a unique value?
Serene Sphinx
Serene SphinxOP2w ago
Yes can you join meet?
Kringe
Kringe2w ago
Is it then not unnecessary to also check for birthdate and crn
Serene Sphinx
Serene SphinxOP2w ago
Okay. I am just trying to make it realistic
Kringe
Kringe2w ago
meet ? in vc
Serene Sphinx
Serene SphinxOP2w ago
yes So I can share my screen
Kringe
Kringe2w ago
im in vc2
Serene Sphinx
Serene SphinxOP2w ago
Oh Sorry I don't know why it is not fetching the data
Kringe
Kringe2w ago
well if account number is a unique value use that for fetching and make sure it exists in db
Serene Sphinx
Serene SphinxOP2w ago
Okay lemme chect it just a sc No, Account number is not unique only customerid is unique
Kringe
Kringe2w ago
can u use that in your dto
Serene Sphinx
Serene SphinxOP2w ago
Yes No. I am not using CustomerId anywhere
Kringe
Kringe2w ago
so what is the meaning of account number then if its not a unique value
Serene Sphinx
Serene SphinxOP2w ago
Actually, I have created method to assign unique account number Will First or default not work if accountNumber is not unique?
Angius
Angius2w ago
It will
Kringe
Kringe2w ago
the code you wrote is correct and it will work if the values exist I just think using things like birthdate for querying users is not what you want
Angius
Angius2w ago
Look at the database and see if a row with this data exists
Serene Sphinx
Serene SphinxOP2w ago
lemme show you
Serene Sphinx
Serene SphinxOP2w ago
No description
Serene Sphinx
Serene SphinxOP2w ago
Account number is present
Kringe
Kringe2w ago
brithdate
Angius
Angius2w ago
You're querying by CRN, AccountNumber, and Birthdate With && between them
Serene Sphinx
Serene SphinxOP2w ago
No description
Angius
Angius2w ago
Yeah 2000-11-11 birthday account has an ID that ends with a 1 And CRN that ends with a 1
Angius
Angius2w ago
Account with those values does not exist
No description
Serene Sphinx
Serene SphinxOP2w ago
Is it the reason of it?
Angius
Angius2w ago
Uh, yeah? "Give me an account with birthday of a, account number of b, and crn of c" you tell the database "No such thing exists", the database replies Because, indeed, no such account exists
Serene Sphinx
Serene SphinxOP2w ago
got it I'll try and come back again. Thanks, you a lot of friend. You solved my so big problem
Angius
Angius2w ago
No problem
Serene Sphinx
Serene SphinxOP2w ago
You made my day
Unknown User
Unknown User2w ago
Message Not Public
Sign In & Join Server To View
MODiX
MODiX2w ago
If you have no further questions, please use /close to mark the forum thread as answered
Serene Sphinx
Serene SphinxOP2w ago
How to do this? Close post?
Want results from more Discord servers?
Add your server