The question is this. I want to create an API request to search for text in the database. When using the SQL query SELECT * FROM dbo.SlideDB WHERE TextSlide like '%TextTest%' in the Database I find all matches. On the Api side, it’s impossible to get all matches with the Like () function.
[HttpGet] [Route("/search/{searchform}")] public ActionResult Search(string searchform) { // Находит не все соответствия var search = _context.SlideDB.Where(p => p.TextSlide == searchform); // Вылетает ошибка var search = _context.SlideDB.Where(p => EF.Functions.Like(p.TextSlide, "%{searchform}%")); return Ok(search); }
_context.SlideDB.Where(p => p.TextSlide.Contains(searchform));? - tym32167