public virtual BadWord UpdateBadWord(BadWord entity)
        {
            if (entity.IsTransient())
            {
                return(entity);
            }
            BadWord other = GetBadWord(entity.BadWordId);

            if (entity.Equals(other))
            {
                return(entity);
            }
            string sql = @"Update BadWord set  [LocaleSetting]=@LocaleSetting
							, [Word]=@Word
							, [CreatedOn]=@CreatedOn 
							 where BadWordID=@BadWordID"                            ;

            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@BadWordID", entity.BadWordId)
                , new SqlParameter("@LocaleSetting", entity.LocaleSetting)
                , new SqlParameter("@Word", entity.Word)
                , new SqlParameter("@CreatedOn", entity.CreatedOn)
            };
            SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray);
            return(GetBadWord(entity.BadWordId));
        }
        public virtual BadWord InsertBadWord(BadWord entity)
        {
            BadWord other = new BadWord();

            other = entity;
            if (entity.IsTransient())
            {
                string         sql            = @"Insert into BadWord ( [LocaleSetting]
				,[Word]
				,[CreatedOn] )
				Values
				( @LocaleSetting
				, @Word
				, @CreatedOn );
				Select scope_identity()"                ;
                SqlParameter[] parameterArray = new SqlParameter[] {
                    new SqlParameter("@BadWordID", entity.BadWordId)
                    , new SqlParameter("@LocaleSetting", entity.LocaleSetting)
                    , new SqlParameter("@Word", entity.Word)
                    , 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(GetBadWord(Convert.ToInt32(identity)));
            }
            return(entity);
        }