public IActionResult GetMedicineByName([FromRoute] string name) { if (!string.IsNullOrEmpty(name)) { var medicine = _context.Medicine .Select(m => m) .Where(m => m.MedicineName.Contains(name) && m.Pharmacies.Any(x => x.FkMedicineId == m.MedicineId)) .Include(m => m.Pharmacies) .ToList(); if (medicine.Count != 0) { return(Ok(_mapper.GetMedicineDto(medicine))); } return(NotFound()); } return(NotFound()); }