public void ReviewABook(string isbn, string comment, int rating)
        {
            /* Book desiredBook;
             * foreach (Book item in _bookRepo.GetBooks())
             * {
             *   if (item.Isbn == isbn)
             *   {
             *       desiredBook = item;
             *       break;
             *   }
             * }
             *
             * Review r = new Review();
             * r.Comment = comment;
             * r.Rating = rating;
             * r.BookFK = isbn;
             *
             * _reviewRepo.Add(r);
             */



            if (_bookRepo.GetBooks().SingleOrDefault(item => item.Isbn == isbn) != null)
            {
                //shall allow the review to be added

                Review r = new Review();
                r.Comment = comment;
                r.Rating  = rating;
                r.BookFK  = isbn;

                _reviewRepo.Add(r);
            }
        }
Beispiel #2
0
        public void ReviewABook(int isbn, string comment, int rating)
        {
            if (_bookRepo.GetBooks().SingleOrDefault(x => x.Isbn == isbn) != null)
            {
                //shall allow the review to be added

                Review r = new Review();
                r.Comment = comment;
                r.Rating  = rating;
                r.BookFK  = isbn;

                _reviewRepo.Add(r);
            }
        }