public void AddRows() { Console.Write("."); List <Contribution> contributionList = new List <Contribution>(); foreach (var contribution in DataFactory.GetContributionList()) { contributionList.Add(new Contribution { ContributionID = contribution.ID, Contributor = contribution.FirstName + " " + contribution.LastName, City = contribution.City + ", " + contribution.State, State = contribution.State, Zip = contribution.ZipCode, Gender = contribution.Gender, Time = contribution.Time, Amount = contribution.Amount }); } ContributionSet contributionSet = new ContributionSet { rows = contributionList.ToArray <Contribution>() }; string jsonRows = JsonConvert.SerializeObject(contributionSet); string restUrlDatasets = rootUrlPowerBiService + "datasets"; string restUrlTableRows = string.Format("{0}/{1}/tables/Contributions/rows", restUrlDatasets, ContributionsDatasetId); string json = ExecutePostRequest(restUrlTableRows, jsonRows); }
public void AddRows() { Console.Write("."); List<Contribution> contributionList = new List<Contribution>(); foreach (var contribution in DataFactory.GetContributionList()) { contributionList.Add(new Contribution { ContributionID = contribution.ID, Contributor = contribution.FirstName + " " + contribution.LastName, City = contribution.City + ", " + contribution.State, State = contribution.State, Zip = contribution.ZipCode, Gender = contribution.Gender, Time = contribution.Time, Amount = contribution.Amount }); } ContributionSet contributionSet = new ContributionSet { rows = contributionList.ToArray<Contribution>() }; string jsonRows = JsonConvert.SerializeObject(contributionSet); string restUrlDatasets = rootUrlPowerBiService + "datasets"; string restUrlTableRows = string.Format("{0}/{1}/tables/Contributions/rows", restUrlDatasets, ContributionsDatasetId); string json = ExecutePostRequest(restUrlTableRows, jsonRows); }