Click here to Skip to main content
15,913,722 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I would like to be able to query the (name) parameter such as (api/data?name=prestl,accam,bcam...(25 values). This is currently what I have and the code is throwing me the following issues:

Delegate 'System.Func<Testing_Apr.database_Bd,int,bool>' does not take 1 arguments

string' does not contain a definition for 'split' and no extension method 'split' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)

C#
var data = db.database_Bd.AsQueryable();

            if (query.startDate != null)
            {
                data = data.Where(c => c.UploadDate >= query.startDate);
            }

            if (!string.IsNullOrEmpty(query.name))
            {
                var list = query.name.split(',');
                data = data.Where(pr => list.Any(pr2 => pr.Name.Contains(pr2)));
            }



Any advice, would be very much appreciated.
Many thanks
Posted
Updated 24-Apr-14 23:10pm
v3

1 solution

C# is case sensitive: "split" is not the same as "Split"

Try:
C#
var list = query.name.Split(',');
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900