Good Morning,
Please do let me know how to check if the data is already present in the db while creating another record using ASP.Net Core6
Thank you
Good Morning,
Please do let me know how to check if the data is already present in the db while creating another record using ASP.Net Core6
Thank you
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Nitin SontakkeRank #264 · 9.6K reputationPosted Jun 7, 2022, 2:21 AM EDT
To begin with, personally, I won't expect / know business layer / middleware to have this knowledge.
The question is what is your criteria of determining if record already exists, this matters a lot.
Typically all data entities expect to have a unique primary key which is numeric. If such is the case, then any corrosponding property of a model class will have 0 value. This is one way.
Another approach is to have a single stored procedure on db side responsible for insert and update as well.
This procedure can have your custom criteria of record existance checking and taking action accordingly.
Hope you understand.
Any questions, please do let me know.
Nitin SontakkeRank #264 · 9.6K reputationPosted Jun 7, 2022, 3:50 AM EDT
Sachin SinghRank #66 · 26.2K reputationPosted Jun 7, 2022, 4:42 AM EDT
Preetham ThangammaRank #7,001 · 251 reputationPosted Jun 7, 2022, 3:37 AM EDT
Preetham ThangammaRank #7,001 · 251 reputationPosted Jun 7, 2022, 5:17 AM EDT
Sachin SinghRank #66 · 26.2K reputationPosted Jun 7, 2022, 5:58 AM EDT
why can't you use jquery in core 6?
Preetham ThangammaRank #7,001 · 251 reputationPosted Jun 7, 2022, 7:44 AM EDT
Jaydeep PatilRank #205 · 11.7K reputationPosted Jun 7, 2022, 11:59 PM EDT