Created
December 11, 2014 08:31
-
-
Save lurumad/5fdf2c5745c406d588a1 to your computer and use it in GitHub Desktop.
Reto 7 MSDN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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