I am trying to filter a model with two dropdown in an MVC project
var model = (from x in db.TABLE....
join y in db.TABLE...).Where(where)...
my logic is
String where = string.Empty;
if (search.anno != null)
where = " ANNO = " + search.anno ;
if (search.Cliente != null)
{
if (!string.IsNullOrEmpty(where))
{
where += " And CODICE_CLIENTE = '" + search.Cliente + "'"; }
else
{
where = " CODICE_CLIENTE = '" + search.Cliente + "'";
}
}
i get an error: System.Linq.Dynamic.ParseException: Character literal must contain exactly one character
i get that in where += " And CODICE_CLIENTE = '" + search.Cliente + "'";
i saw that the Apex at the end is '"
how can solve