Hello!! I have a Table named storedetails where I need To insert storeID and itemID. This insertion should be unique and when inserted Then later IT will be updated regarding The storeID and itemID. The Table is as follows:
ID - StoreID - CategoryID - ItemID - Quantity
1 - 1 - 2 - 1002 - 20
2 - 2 - 2 - 1002 - 40
3 - 1 - 2 - 1002 - 60
4 - 1 - 2 - 1004 - 80
What I am Trying To do is To stop data redundancy. Here AT ID 1 & 3 The data stored is a duplicate entry. I have Tried To prevent This with The following code but failed:
List<storedetails> con = (from c in context.storedetails
select c).ToList();
List<EmployeeDetails> con2 = (from d in context.EmployeeDetails
where d.EmployeeID == m
select d).ToList();
foreach(EmployeeDetails d in con2)
{
foreach(storedetails c in con)
{
if(c.StoreID == m && c.ItemID == k) //m & k are user input
{
...
Go to the complete details ...