Пример #1
0
        public object Get(GetInfoRequest request)
        {
            //get/{MediaType}/{All}/{Pending}/{Downloaded}
            if (request.MediaType == "show")
            {
                if (request.Pending == "true")
                {
                    Console.WriteLine("Pending shows request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                    return(JsonSerializer.SerializeToString(RestUtils.GetPendingDownloaded(true, true)));
                }
                else if (request.Downloaded == "true")
                {
                    Console.WriteLine("Downloaded shows request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                    return(JsonSerializer.SerializeToString(RestUtils.GetPendingDownloaded(true, false)));
                }
                else
                {
                    if (request.All == "true")
                    {
                        Console.WriteLine("All shows request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                        return(JsonSerializer.SerializeToString(RestUtils.GetShows(true)));
                    }
                    else
                    {
                        Console.WriteLine("My shows request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                        return(JsonSerializer.SerializeToString(RestUtils.GetShows(false)));
                    }
                }
            }

            else
            {
                if (request.Pending == "true")
                {
                    Console.WriteLine("Pending movies request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                    return(JsonSerializer.SerializeToString(RestUtils.GetPendingDownloaded(false, true)));
                }
                else if (request.Downloaded == "true")
                {
                    Console.WriteLine("Downloaded movies request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                    return(JsonSerializer.SerializeToString(RestUtils.GetPendingDownloaded(false, false)));
                }
                else
                {
                    if (request.All == "true")
                    {
                        Console.WriteLine("All movies request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                        return(JsonSerializer.SerializeToString(RestUtils.GetMovies(true)));
                    }
                    else
                    {
                        Console.WriteLine("My movies request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                        return(JsonSerializer.SerializeToString(RestUtils.GetMovies(false)));
                    }
                }
            }
        }
Пример #2
0
        public object Get(GetInfoRequest request)
        {
            //get/{MediaType}/{All}/{Pending}/{Downloaded}
            if (request.MediaType == "show")
            {
                if (request.Pending == "true")
                {
                    Console.WriteLine("Pending shows request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                    return JsonSerializer.SerializeToString(RestUtils.GetPendingDownloaded(true, true));
                }
                else if (request.Downloaded == "true")
                {
                    Console.WriteLine("Downloaded shows request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                    return JsonSerializer.SerializeToString(RestUtils.GetPendingDownloaded(true, false));
                }
                else
                {
                    if (request.All == "true")
                    {
                        Console.WriteLine("All shows request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                        return JsonSerializer.SerializeToString(RestUtils.GetShows(true));
                    }
                    else
                    {
                        Console.WriteLine("My shows request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                        return JsonSerializer.SerializeToString(RestUtils.GetShows(false));
                    }
                }
            }

            else
            {
                if (request.Pending == "true")
                {
                    Console.WriteLine("Pending movies request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                    return JsonSerializer.SerializeToString(RestUtils.GetPendingDownloaded(false, true));
                }
                else if (request.Downloaded == "true")
                {
                    Console.WriteLine("Downloaded movies request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                    return JsonSerializer.SerializeToString(RestUtils.GetPendingDownloaded(false, false));
                }
                else
                {
                    if (request.All == "true")
                    {
                        Console.WriteLine("All movies request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                        return JsonSerializer.SerializeToString(RestUtils.GetMovies(true));
                    }
                    else
                    {
                        Console.WriteLine("My movies request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                        return JsonSerializer.SerializeToString(RestUtils.GetMovies(false));
                    }
                }
            }
        }