public DataTable GetReviewAndRating(ReviewAndRatings ProductData) { DataTable ReviewAndRating = new DataTable(); using (SqlConnection conn = new SqlConnection(_connectionString)) { conn.Open(); SqlCommand cmd = new SqlCommand(Common.StoreProcedure.GetReviewAndRatings, conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@ProductId", ProductData.ProductId); SqlDataAdapter sda = new SqlDataAdapter(cmd); sda.Fill(ReviewAndRating); } return(ReviewAndRating); }
public DataTable AddReviewAndRating(ReviewAndRatings ReviewsAndRatings) { DataTable ReviewAndRating = new DataTable(); using (SqlConnection conn = new SqlConnection(_connectionString)) { conn.Open(); SqlCommand cmd = new SqlCommand(Common.StoreProcedure.AddReviewAndRatings, conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@ProductId", ReviewsAndRatings.ProductId); cmd.Parameters.AddWithValue("@Ratings", ReviewsAndRatings.Ratings); cmd.Parameters.AddWithValue("@Comments", ReviewsAndRatings.Comments); cmd.Parameters.AddWithValue("@UserId", 1); SqlDataAdapter sda = new SqlDataAdapter(cmd); sda.Fill(ReviewAndRating); } return(ReviewAndRating); }
public HttpResponseMessage GetReviewAndRating(ReviewAndRatings ProductData) { DataTable ReviewRatings = _iProductsRepository.GetReviewAndRating(ProductData); return(Request.CreateResponse(HttpStatusCode.OK, ReviewRatings)); }