Skip to content

Instantly share code, notes, and snippets.

@lurumad
Created December 11, 2014 08:31
Show Gist options
  • Select an option

  • Save lurumad/5fdf2c5745c406d588a1 to your computer and use it in GitHub Desktop.

Select an option

Save lurumad/5fdf2c5745c406d588a1 to your computer and use it in GitHub Desktop.
Reto 7 MSDN
public class JsonSplitter
{
public static Result SplitShowsByGenre(string trendingShowsJson, string comedy)
{
var trendingShows =
JsonConvert.DeserializeObject<List<Movie>>(trendingShowsJson);
var comedyShows = trendingShows.Where(m => m.Genres.Contains(comedy));
var noComedyShows = trendingShows.Where(m => !m.Genres.Contains(comedy));
return new Result
{
Item1 = JsonConvert.SerializeObject(comedyShows),
Item2 = JsonConvert.SerializeObject(noComedyShows)
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment