MVC - Where Equals Contains in SQL

by
Jeremy Canfield |
Updated: March 20 2020
| MVC articles
In your controller, use the following to return results where column1 contains xyz.
public ActionResult Index()
{
return View(db.Example.Where(x => x.column1.Contains("xyz")).ToList());
}
Use the following to return results where column1 equals xyz.
public ActionResult Index()
{
return View(db.Example.Where(x => x.column1.Equals("xyz")).ToList());
}
Did you find this article helpful?
If so, consider buying me a coffee over at