public static ReviewOfCustomerModel GetReviewByISBN(int customer_id, string book_isbn) { using (IDbConnection connection = new SqlConnection(Tools.GetConnectionStringValue())) { string sql = @"SELECT re.book_isbn, bo.title, re.review_rate, re.review_content, re.review_date FROM [dbo].[Reviews] re LEFT JOIN [dbo].[Books] bo ON re.book_isbn = bo.ISBN WHERE customer_id = @CustomerId and book_isbn = @BookISBN"; ReviewOfCustomerModel review = connection.QueryFirst <ReviewOfCustomerModel>(sql, new { CustomerID = customer_id, BookISBN = book_isbn }); return(review); } }
public void ShowDetail(string order_id, FullBookModel book, bool is_reviewed) { _orderId = order_id; _book = book; _isReviewed = is_reviewed; if (_isReviewed) { ReviewOfCustomerModel review = ReviewOfCustomerDataAccess.GetReviewByISBN(CustomerInfo.customer.Id, _book.ISBN); _reviewRate = review.Review_Rate; SetReviewRate(); textBoxReviewContent.Text = review.Review_Content; } textBoxISBN.Text = _book.ISBN; textBoxTitle.Text = _book.Title; }