0

I know how to do a where in Qlink... p.e.

public ActionResult Index(){
    using (DBEntities db = new DBEntities())
    {
        return View(db.vw_values.Where(m => m.value == 1).ToList());
    }
}

but I want to do a Where in but I´ve not found how to implement it... p.e.

... int[] values = {1,2,3, ...}
    return View(db.vw_values.Where(m => m.value == values).ToList()); ...

is it posible? (The idea, I know that this code is wrong)

1 Answers1

1

All you have to do is:

public ActionResult Index()
{
    using (DBEntities db = new DBEntities())
    {
        return View(db.vw_values.Where(m => values.Contains(m.value).ToList());
    }
}

Here you can learn more about LINQ in C# and all the other cool things you can do with it.

AustinWBryan
  • 3,249
  • 3
  • 24
  • 42