Ejemplo n.º 1
0
        public Model.SlackWebhookResponse Execute(string searchTerm, string channel, string userName)
        {
            var omdb     = new Omdb.Integration.OmdbQuery();
            var response = new Model.SlackWebhookResponse();
            var results  = omdb.Search(searchTerm);

            var foundResult = results.Search.Count > 0;

            if (foundResult)
            {
                response = new Model.SlackWebhookResponse().FromOmdbSearchResult(results);
                response.payload.channel = "#" + channel;
            }
            else
            {
                var searchResults = omdb.Search(searchTerm);
                response = new Model.SlackWebhookResponse().EmptyResultResponse(searchTerm, channel, userName);
            }

            return(response);
        }
Ejemplo n.º 2
0
        public Model.SlackWebhookResponse Execute(string searchTerm, string channel, string userName)
        {
            var omdb     = new Omdb.Integration.OmdbQuery();
            var response = new Model.SlackWebhookResponse();
            var result   = omdb.SearchSingleResult(searchTerm);

            var foundResult = string.IsNullOrEmpty(result.Title) ? false : true;

            if (foundResult)
            {
                response = new Model.SlackWebhookResponse().FromOmdbTitle(result);
                response.payload.channel = "#" + channel;
            }
            else
            {
                var searchResults = omdb.Search(searchTerm);
                response = new Model.SlackWebhookResponse().EmptyResultResponse(searchTerm, channel, userName);
            }

            return(response);
        }