public async Task <ActionResult <IEnumerable <Applicant> > > Search(string name) { try { Log.Debug($"{Section.GetValue<string>("DebugAPIget")}{nameof(Search)}\nCode: [{Code200}]"); var result = await applicantRepository.Search(name); if (result.Any()) { Log.Information($"{Section.GetValue<string>("Search")}\nResult:[{result}]"); return(Ok(result)); } Log.Error($"{Section.GetValue<string>("NotFound")}[object={nameof(Applicant.Name)}; name={name}]"); return(NotFound()); } catch (Exception err) { Log.Error($"Exception occured: [{err}]\nStatusCode:{Code500}"); return(StatusCode(Code500, Section.GetValue <string>("RetreiveFromDbError"))); } }
Applicant IApplicantService.Search(string keyword) { var result = _repository.Search(keyword); return(result); }