Master
Master

Reputation: 2163

Trouble With Linq Where Clause

Hi I'm having difficulties writing my linq query. Not sure where to put my Where clause.

using (var ctx = DB.Get())
        {
            Interaction = new BindableCollection<InteractionDTO>(
                ctx.Interactions.Select(
                x => new InteractionDTO
                {
                    Indepth = x.Indepth  
                }
                )
           );
        }

where do I put this code or how do i write it in a manner it'll work with the syntax above. where date>= StartDate.SelectedDate.Value

Upvotes: 0

Views: 71

Answers (2)

Aftab Ahmed
Aftab Ahmed

Reputation: 1747

try this one

            ctx.Interactions
            .where (x=> date >=x.StartDate)
            .Select(x => new InteractionDTO
            {
                Indepth = x.Indepth  
            });

Upvotes: 2

Selman Gen&#231;
Selman Gen&#231;

Reputation: 101732

Something like this should work

ctx.Interactions.
   .Where(x => x.date >= StartDate.SelectedDate.Value) 
   .Select(x => new InteractionDTO
            {
                Indepth = x.Indepth  
            })

Upvotes: 2

Related Questions