In asp.net mvc4 project I am using predicate builder. Here is my code:
public static Expression<Func<AdModel, bool>> AddConditionToQuery( )
{
Guid g = new Guid("d521291f-2edb-4efc-96ac-25a4993bf028");
predicate = predicate.Or(p => (p.OptionID == g) && ( Convert.ToInt32(p.AdDetail) > 10000) );
return predicate;
}
var result = (
from p in mev.AdModels.AsExpandable().Where(filter)
select new
{
mev.AdCategoryTrees.FirstOrDefault(s => s.AdID == p.AdID).CategoryID,
mev.AdCategoryTrees.FirstOrDefault(s => s.AdID == p.AdID).CategoryName,
}).Distinct();
For Convert.ToInt32
I am taking error below. Is there any other wat to do thıs.
Additional information: LINQ to Entities does not recognize the method 'Int32 ToInt32(System.String)' method, and this method cannot be translated into a store expression.
Thank you.