public IActionResult Detail(int id) { ViewBag.BookReviewed = id; List <Review> Reviews = ReviewRepo.GetReviewsByBookID(id); BookViewModel VM = BookConverter.BookToBookViewModel(BookRepo.GetBookByID(id)); foreach (Review R in Reviews) { VM.Reviews.Add(ReviewConverter.ReviewToReviewViewModel(R)); } return(View(VM)); }
public IActionResult Index() { int id = Convert.ToInt32(this.User.FindFirstValue(ClaimTypes.NameIdentifier)); List <Book> Books = BookRepo.GetUserBacklog(id); List <Review> Reviews = ReviewRepo.GetAllReviewsByUserID(id); OverviewViewModel VM = new OverviewViewModel(); foreach (Book B in Books) { VM.UserBacklog.Books.Add(BookConverter.BookToBookViewModel(B)); } foreach (Review R in Reviews) { VM.UserReviews.Reviews.Add(ReviewConverter.ReviewToReviewViewModel(R)); } return(View(VM)); }
public IActionResult Detail(int id) { ReviewViewModel VM = Converter.ReviewToReviewViewModel(Repo.GetReviewByID(id)); return(View(VM)); }