Esempio n. 1
0
        public async Task SetInstagramAccounts(Page page)
        {
            var response = await _facebookClient.GetAsync <dynamic>(page.AccessToken, $"{page.Id}/instagram_accounts");

            if (response == null || response.data == null)
            {
                throw new Exception("Page not found. ");
            }

            var instagramAccounts = new List <InstagramAccount>();

            foreach (var instagramAccountDynamic in response.data)
            {
                InstagramAccount instagramAccount = _modelMapper.GetInstagramAccount(instagramAccountDynamic);
                instagramAccounts.Add(instagramAccount);
            }

            page.InstagramAccounts = instagramAccounts;
        }