예제 #1
0
        private static void doDThings()
        {
            foreach (CRUDMovieServiceReference.Movie movie in movieClient.getAllMovies())
            {
                Console.WriteLine("{0} {1} {2}", movie.Id, movie.Title, movie.ReleaseYear);
            }
            Console.WriteLine("Wpisz numer filmu ktory chcesz zobaczyc");
            int option = 0;

            CRUDMovieServiceReference.Movie chosenMovie = movieClient.GetMovie(option);
            int avg = 0;

            CRUDReviewAndPersonServiceReference.Review[] reviews = reviewAndPersonClient.getAllReviews();
            if (Int32.TryParse(Console.ReadLine(), out option))
            {
                int i = 0;
                foreach (CRUDReviewAndPersonServiceReference.Review review in reviews)
                {
                    if (review.MovieId == option)
                    {
                        Console.WriteLine("{0} ||| {1} {2}", review.Content, review.Author.Name, review.Author.Surname);
                        i++;
                        avg += review.Score;
                    }
                }
                if (i > 0)
                {
                    Console.WriteLine("Srednia ocen: {0}", avg / i);
                }
            }
        }
예제 #2
0
        private static void doEThings()
        {
            Console.WriteLine("Podaj tytul");
            string title = Console.ReadLine();

            Console.WriteLine("Podaj rok");
            int year = 0;

            if (Int32.TryParse(Console.ReadLine(), out year))
            {
                CRUDMovieServiceReference.Movie lastMovie = movieClient.getAllMovies().LastOrDefault();
                int id = lastMovie == null ? 1 : lastMovie.Id + 1;
                movieClient.AddMovie(new CRUDMovieServiceReference.Movie()
                {
                    Title = title, ReleaseYear = year, Id = id
                });
            }
        }