Select items by filters that contains a string

  • Thread starter Thread starter first100
  • Start date Start date
F

first100

Guest
Hello,

i have a search form in my mvc application, on my controller i select with linq query the items that matches with my search filters, now i have to search also for items thats have in the name starting with a string my implementation is :


// the object searchItems contains all field of search form valorized

var searchItems = context.BoxItems.Where(si =>
searchKeys.Department == si.Dep ||
searchKeys.St == si.St ||
searchKeys.IdNumber == si.IdNumber ||
si.Desc.StartsWith(searchKeys.Desc))

).ToList();

// in this case i dont have my item that have Desc start for "123"

// if i try to filters only for desc:
// in this case i have my item that have Desc start for "123"

var sample = context.BoxItems.Where(si => si.Desc .StartsWith(searchKeys.Desc ));

How i can do to retrive my item when desc start whits somethings?

Thanks


www.Photoballot.net

Continue reading...
 
Back
Top