Hello all.
Struggling a bit today.
I have the following method that returns a list of products..lovely.
public static List<tblWeight> GetProductInfo(string memberid, string locationid, string basematerial, string source)
{
MyEntities getproductinfo = new MyEntities ();
return (from p in getproductinfo .tblWeights
where p.MemberId == memberid &&
p.LocationId == locationid &&
p.BaseMaterialName == basematerial &&
p.WeightStatus == source
select p)
.ToList();
- Where basematerial & source are drop down lists.
How do I go about incorporating a few IF statements into the where clause?
For example, if the basematerial ddl is not touched but an item in the source ddl is selected, the result would return everything associated with basematerial but filtered by the selected source.
Does that even make sense?!
I'm not even sure I am taking the correct approach - please forgive my ignorance.