public virtual CustomerGiftRegistrySearches UpdateCustomerGiftRegistrySearches(CustomerGiftRegistrySearches entity)
        {
            if (entity.IsTransient())
            {
                return(entity);
            }
            CustomerGiftRegistrySearches other = GetCustomerGiftRegistrySearches(entity.CustomerGiftRegistrySearchesId);

            if (entity.Equals(other))
            {
                return(entity);
            }
            string sql = @"Update CustomerGiftRegistrySearches set  [CustomerGiftRegistrySearchesGUID]=@CustomerGiftRegistrySearchesGUID
							, [CustomerID]=@CustomerID
							, [GiftRegistryGUID]=@GiftRegistryGUID
							, [CreatedOn]=@CreatedOn 
							 where CustomerGiftRegistrySearchesID=@CustomerGiftRegistrySearchesID"                            ;

            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@CustomerGiftRegistrySearchesID", entity.CustomerGiftRegistrySearchesId)
                , new SqlParameter("@CustomerGiftRegistrySearchesGUID", entity.CustomerGiftRegistrySearchesGuid)
                , new SqlParameter("@CustomerID", entity.CustomerId)
                , new SqlParameter("@GiftRegistryGUID", entity.GiftRegistryGuid)
                , new SqlParameter("@CreatedOn", entity.CreatedOn)
            };
            SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray);
            return(GetCustomerGiftRegistrySearches(entity.CustomerGiftRegistrySearchesId));
        }
        public virtual CustomerGiftRegistrySearches InsertCustomerGiftRegistrySearches(CustomerGiftRegistrySearches entity)
        {
            CustomerGiftRegistrySearches other = new CustomerGiftRegistrySearches();

            other = entity;
            if (entity.IsTransient())
            {
                string         sql            = @"Insert into CustomerGiftRegistrySearches ( [CustomerGiftRegistrySearchesGUID]
				,[CustomerID]
				,[GiftRegistryGUID]
				,[CreatedOn] )
				Values
				( @CustomerGiftRegistrySearchesGUID
				, @CustomerID
				, @GiftRegistryGUID
				, @CreatedOn );
				Select scope_identity()"                ;
                SqlParameter[] parameterArray = new SqlParameter[] {
                    new SqlParameter("@CustomerGiftRegistrySearchesID", entity.CustomerGiftRegistrySearchesId)
                    , new SqlParameter("@CustomerGiftRegistrySearchesGUID", entity.CustomerGiftRegistrySearchesGuid)
                    , new SqlParameter("@CustomerID", entity.CustomerId)
                    , new SqlParameter("@GiftRegistryGUID", entity.GiftRegistryGuid)
                    , 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(GetCustomerGiftRegistrySearches(Convert.ToInt32(identity)));
            }
            return(entity);
        }