public SearchLightCommandResult Search([FromQuery] string term) { SearchLightCommand command = new SearchLightCommand(); command.SetTerm(term ?? string.Empty); return(Execute <SearchLightCommand, SearchLightCommandResult>(command)); }
public SearchLightCommandResult Handle(SearchLightCommand command) { SearchLightCommandResult result = new SearchLightCommandResult(); List <ObjectId> lights = _lightRepository.Search(command.Term).ToList(); if (lights.Count > 0) { result = new SearchLightCommandResult(HttpStatusCode.OK, lights); } else if (_lightRepository.Valid) { result = new SearchLightCommandResult(HttpStatusCode.NoContent); } return(result); }