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
Angius3mo ago
You sure the customer with those values exists? .FirstOrDefaultAsync() returns null if there's no entry matching the predicate
Serene Sphinx
Serene SphinxOP3mo ago
I have data in Database I am sending data through Postman which is available in Database.
Kringe
Kringe3mo ago
Is account number a unique value?
Serene Sphinx
Serene SphinxOP3mo ago
Yes can you join meet?
Kringe
Kringe3mo ago
Is it then not unnecessary to also check for birthdate and crn
Serene Sphinx
Serene SphinxOP3mo ago
Okay. I am just trying to make it realistic
Kringe
Kringe3mo ago
meet ? in vc
Serene Sphinx
Serene SphinxOP3mo ago
yes So I can share my screen
Kringe
Kringe3mo ago
im in vc2
Serene Sphinx
Serene SphinxOP3mo ago
Oh Sorry I don't know why it is not fetching the data
Kringe
Kringe3mo ago
well if account number is a unique value use that for fetching and make sure it exists in db
Serene Sphinx
Serene SphinxOP3mo ago
Okay lemme chect it just a sc No, Account number is not unique only customerid is unique
Kringe
Kringe3mo ago
can u use that in your dto
Serene Sphinx
Serene SphinxOP3mo ago
Yes No. I am not using CustomerId anywhere
Kringe
Kringe3mo ago
so what is the meaning of account number then if its not a unique value
Serene Sphinx
Serene SphinxOP3mo ago
Actually, I have created method to assign unique account number Will First or default not work if accountNumber is not unique?
Angius
Angius3mo ago
It will
Kringe
Kringe3mo 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
Angius3mo ago
Look at the database and see if a row with this data exists
Serene Sphinx
Serene SphinxOP3mo ago
lemme show you
Serene Sphinx
Serene SphinxOP3mo ago
No description
Serene Sphinx
Serene SphinxOP3mo ago
Account number is present
Kringe
Kringe3mo ago
brithdate
Angius
Angius3mo ago
You're querying by CRN, AccountNumber, and Birthdate With && between them
Serene Sphinx
Serene SphinxOP3mo ago
No description
Angius
Angius3mo ago
Yeah 2000-11-11 birthday account has an ID that ends with a 1 And CRN that ends with a 1
Angius
Angius3mo ago
Account with those values does not exist
No description
Serene Sphinx
Serene SphinxOP3mo ago
Is it the reason of it?
Angius
Angius3mo 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 SphinxOP3mo ago
got it I'll try and come back again. Thanks, you a lot of friend. You solved my so big problem
Angius
Angius3mo ago
No problem
Serene Sphinx
Serene SphinxOP3mo ago
You made my day
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
MODiX
MODiX3mo ago
If you have no further questions, please use /close to mark the forum thread as answered
Serene Sphinx
Serene SphinxOP3mo ago
How to do this? Close post?

Did you find this page helpful?