public virtual RatingCommentHelpfulness UpdateRatingCommentHelpfulness(RatingCommentHelpfulness entity)
        {
            if (entity.IsTransient())
            {
                return(entity);
            }
            RatingCommentHelpfulness other = GetRatingCommentHelpfulness(entity.StoreId);

            if (entity.Equals(other))
            {
                return(entity);
            }
            string sql = @"Update RatingCommentHelpfulness set  [ProductID]=@ProductID
							, [RatingCustomerID]=@RatingCustomerID
							, [VotingCustomerID]=@VotingCustomerID
							, [Helpful]=@Helpful
							, [CreatedOn]=@CreatedOn 
							 where StoreID=@StoreID"                            ;

            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@StoreID", entity.StoreId)
                , new SqlParameter("@ProductID", entity.ProductId)
                , new SqlParameter("@RatingCustomerID", entity.RatingCustomerId)
                , new SqlParameter("@VotingCustomerID", entity.VotingCustomerId)
                , new SqlParameter("@Helpful", entity.Helpful)
                , new SqlParameter("@CreatedOn", entity.CreatedOn)
            };
            SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray);
            return(GetRatingCommentHelpfulness(entity.StoreId));
        }
        public virtual RatingCommentHelpfulness InsertRatingCommentHelpfulness(RatingCommentHelpfulness entity)
        {
            RatingCommentHelpfulness other = new RatingCommentHelpfulness();

            other = entity;
            if (entity.IsTransient())
            {
                string         sql            = @"Insert into RatingCommentHelpfulness ( [StoreID]
				,[ProductID]
				,[RatingCustomerID]
				,[VotingCustomerID]
				,[Helpful]
				,[CreatedOn] )
				Values
				( @StoreID
				, @ProductID
				, @RatingCustomerID
				, @VotingCustomerID
				, @Helpful
				, @CreatedOn );
				Select scope_identity()"                ;
                SqlParameter[] parameterArray = new SqlParameter[] {
                    new SqlParameter("@StoreID", entity.StoreId)
                    , new SqlParameter("@ProductID", entity.ProductId)
                    , new SqlParameter("@RatingCustomerID", entity.RatingCustomerId)
                    , new SqlParameter("@VotingCustomerID", entity.VotingCustomerId)
                    , new SqlParameter("@Helpful", entity.Helpful)
                    , new SqlParameter("@CreatedOn", entity.CreatedOn)
                };
                var identity = SqlHelper.ExecuteScalar(this.ConnectionString, CommandType.Text, sql, parameterArray);
                if (identity == DBNull.Value)
                {
                    throw new DataException("Identity column was null as a result of the insert operation.");
                }
                return(GetRatingCommentHelpfulness(Convert.ToInt32(identity)));
            }
            return(entity);
        }