Hello Wessam,
You can use below LINQ query
var query = from d in db.Members select d;
if (!string.IsNullOrEmpty(memName))
query = query.Where(m => m.MemberName == memName);
if (!string.IsNullOrEmpty(memCode))
query = query.Where(m => m.MemberCode == memCode);
var memberList = query.ToList();
Happy to Help!