Esempio n. 1
0
        public SearchLightCommandResult Search([FromQuery] string term)
        {
            SearchLightCommand command = new SearchLightCommand();

            command.SetTerm(term ?? string.Empty);

            return(Execute <SearchLightCommand, SearchLightCommandResult>(command));
        }
Esempio n. 2
0
        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);
        }