I have a List of integers

Code:
List<int> LI = new List<int>();
i wants check whether a particular number exists in the list.if exists do a database updation else do a database insert

Code:
foreach (int IT in LI)
            {
           
            }
can i do this inside the foreach loop or if not possible how to achieve this?????