public ReviewListView(int bookId) { localhost.Service1 s = new localhost.Service1(); if (s.FindReviewsByBookId(bookId)!=null) { List<localhost.Review> tList = s.FindReviewsByBookId(bookId).ToList<localhost.Review>(); foreach (localhost.Review review in tList) { _list.Add(review); } } else { localhost.Review r = new localhost.Review(); r.AuthorId = 666; r.Text = "There aren't any reviews at the moment. Be the first one to write one!"; _list.Add(r); } }
public static void UpdateReviews() { localhost.Service1 service = new localhost.Service1(); List<localhost.Review> rl; //service.FindReviewsByBookId(SelectedBook.Id).ToList<localhost.Review>(); if (SelectedBook != null) { if (service.FindReviewsByBookId(SelectedBook.Id) != null) { rl = service.FindReviewsByBookId(SelectedBook.Id).ToList<localhost.Review>(); } else { rl = null; } } else { rl = null; } _reviewList.Clear(); if (rl != null) { foreach (localhost.Review review in rl) { _reviewList.Add(review); } } else { _reviewList.Clear(); } }