Example #1
0
        private static void doAThings()
        {
            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 ocenic");
            int option = 0;

            if (Int32.TryParse(Console.ReadLine(), out option))
            {
                Console.WriteLine("Wpisz recenzje, ENTER konczy");
                string content = Console.ReadLine();
                Console.WriteLine("Wpisz ocene (0-100)");
                int rate = 0;
                while (!Int32.TryParse(Console.ReadLine(), out rate))
                {
                    Console.WriteLine("Zla ocena, wpisz jeszcze raz");
                }
                if (rate < 0 || rate > 100)
                {
                    Console.WriteLine("zakres 0-100");
                    return;
                }
                CRUDReviewAndPersonServiceReference.Review r = reviewAndPersonClient.getAllReviews().LastOrDefault();
                int newId = r == null ? 1 : r.Id + 1;
                CRUDReviewAndPersonServiceReference.Person user = reviewAndPersonClient.GetPerson(userId);
                reviewAndPersonClient.AddReview(new CRUDReviewAndPersonServiceReference.Review()
                {
                    Id = newId, Content = content, Score = rate, Author = user, MovieId = option
                });
                return;
            }
            Console.WriteLine("Zly numer");
        }
Example #2
0
        private static void writeNameToDB()
        {
            CRUDReviewAndPersonServiceReference.Person p = reviewAndPersonClient.GetAllPerson().LastOrDefault();
            userId = p == null ? 1 : p.Id + 1;

            reviewAndPersonClient.AddPerson(new CRUDReviewAndPersonServiceReference.Person()
            {
                Id = userId, Name = name, Surname = surname
            });
        }