Пример #1
0
        public static Response[] FilterAndGenerateResponse(Request req)
        {
            int counter = 0;

            try
            {

                List<dynamic> movies = req.payload.Where(p => p.drm == true && p.episodeCount > 0).ToList();

                Response[] responses = new Response[movies.Count()];


                foreach (dynamic movie in movies)
                {


                    responses[counter] = new Response { image = movie.image.showImage, slug = movie.slug, title = movie.title };

                    counter++;


                }

                return responses;
            }
            catch(Exception ex)
            {

                throw new HttpException(400, "bad request");

            }            
        }
Пример #2
0
       public TestJsonObj()
        {
            

            using (StreamReader r = new StreamReader("jsonobj.json"))
            {
                json = r.ReadToEnd();
                request = JsonConvert.DeserializeObject<Request>(json);
            }
        }