While concurrent request is hitting to API it started to save duplicate record rather than checking condtion of duplicate record
I am sharing you my code
if (!db.dbMySampleDataSummary.Any(w => w.userid == id && w.clientId == tokenId))
{
MySampleDataSummary mySampleData = new MySampleDataSummary();mySampleData.userid = id;mySampleData.clientId = tokenId;mySampleData.remarks = "remarks here for testing";mySampleData.mobile = "0123456789";mySampleData.approvedBy = "test user";mySampleData.approvalStatus = true;mySampleData.approvalDate = "2019-11-28";mySampleData.isListed = true;db.dbMySampleDataSummary.Add(mySampleData);db.SaveChanges();
}

Amit GuptaRank #190 · 12.8K reputationPosted Nov 28, 2019, 12:32 AM EST
Dhara Patel108 reputationPosted Nov 28, 2019, 12:38 AM EST
Sam187 reputationPosted Nov 28, 2019, 12:44 AM EST
Dhara Patel108 reputationPosted Nov 28, 2019, 1:02 AM EST
Sam187 reputationPosted Nov 28, 2019, 1:15 AM EST
Amit GuptaRank #190 · 12.8K reputationPosted Nov 28, 2019, 2:08 AM EST
Sam187 reputationPosted Nov 28, 2019, 2:44 AM EST
Ashutosh GuptaRank #805 · 2.9K reputationPosted Nov 28, 2019, 5:29 AM EST
Sagar MaldeRank #2,097 · 684 reputationPosted Nov 29, 2019, 1:10 AM EST
Sam187 reputationPosted Dec 7, 2019, 12:55 AM EST
Amit GuptaRank #190 · 12.8K reputationPosted Dec 7, 2019, 3:15 AM EST