日期:2014-05-20 浏览次数:20797 次
public static List<User> Search(SearchModel model){
var query =
from u in Users;
if(string.IsNullOrEmpty(model.Name) == false){
query = query.Where(m => m.Name.IndexOf(model.Name) >= 0);
}
if(string.IsNullOrEmpty(model.Address) == false){
query = query.Where(m => m.Address.IndexOf(model.Address) >= 0);
}
......
return query.List<User>();
}