Example #1
0
        private static Keyword AttachKeyword(T70Context context)
        {
            var keywordRepo = context.Repository <Keyword>(new
            {
                AccountId = ACCOUNT_ID,
                ChannelId = CHANNEL_ID
            });

            var keyword = keywordRepo.Get(KEYWORD_ID);

            if (keyword.CampaignId.HasValue)
            {
                if (keyword.CampaignId == CAMPAIGN_ID)
                {
                    Console.WriteLine("Keyword {0} already attached to campaign {1}", keyword.Id, CAMPAIGN_ID);
                    return(keyword);
                }

                Console.WriteLine(
                    "NOTICE: Keyword {0} is already attached to campaign {1}, this will get changed.",
                    keyword.Id,
                    keyword.CampaignId);
            }

            context.AttachKeywordTo(keyword, CAMPAIGN_ID);

            return(keyword);
        }
Example #2
0
        private const int KEYWORD_ID = 0; // TODO: Fill in with your keyword ID

        #endregion Fields

        #region Methods

        private static Keyword AttachKeyword(T70Context context)
        {
            var keywordRepo = context.Repository<Keyword>(new
            {
                AccountId = ACCOUNT_ID,
                ChannelId = CHANNEL_ID
            });

            var keyword = keywordRepo.Get(KEYWORD_ID);

            if (keyword.CampaignId.HasValue)
            {
                if (keyword.CampaignId == CAMPAIGN_ID)
                {
                    Console.WriteLine("Keyword {0} already attached to campaign {1}", keyword.Id, CAMPAIGN_ID);
                    return keyword;
                }

                Console.WriteLine(
                    "NOTICE: Keyword {0} is already attached to campaign {1}, this will get changed.",
                    keyword.Id,
                    keyword.CampaignId);
            }

            context.AttachKeywordTo(keyword, CAMPAIGN_ID);

            return keyword;
        }
Example #3
0
 private static void DetachKeyword(T70Context context, Keyword keyword)
 {
     context.AttachKeywordTo(keyword, null);
 }
Example #4
0
 private static void DetachKeyword(T70Context context, Keyword keyword)
 {
     context.AttachKeywordTo(keyword, null);
 }