public async Task <ActionResult> MedicineCourse(int id) { if (id == 0) { throw new NullReferenceException("medicine course not found"); } if (!_context.Medicines.Any()) { throw new NullReferenceException("medicine no entries"); } var medicines = await _medicineService.GetByForeignKey(id); return(Ok(medicines ?? new List <Medicine>())); }