コード例 #1
0
        public IActionResult GetAnyMedicine([FromRoute] string parameter)
        {
            if (!string.IsNullOrEmpty(parameter))
            {
                var medicine = _context.Medicine
                               .Select(m => m)
                               .Where(m => m.MedicineName.Contains(parameter) || m.MedicineType.Contains(parameter) ||
                                      m.MedicineFullName.Contains(parameter))
                               .ToList();

                if (medicine.Count != 0)
                {
                    return(Ok(_mapper.GetMedicinesDto(medicine)));
                }

                return(NotFound());
            }

            return(NotFound());
        }