Skip to content

Instantly share code, notes, and snippets.

@rafaeldalsenter
Created April 3, 2020 01:20
Show Gist options
  • Select an option

  • Save rafaeldalsenter/eba1e10d570a7c41a893087c8020dd47 to your computer and use it in GitHub Desktop.

Select an option

Save rafaeldalsenter/eba1e10d570a7c41a893087c8020dd47 to your computer and use it in GitHub Desktop.
public async Task<DirectorsByCountryDto> GetDirectorsByCountry(string countryName)
{
...
try
{
var cqlQuery = @"select director as Name from netflix_titles where country=? allow filtering";
var returnQuery = await _cassandraContext.SelectAsync<string>(cqlQuery, countryName);
var directors = returnQuery.ToList();
return new DirectorsByCountryDto
{
Country = countryName,
Directors = directors,
ErrorMessage = !directors.Any() ? $"Não foi encontrado nenhum diretor para o país {countryName}" : null
};
}
catch (Exception ex)
{
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment