I got a c# web app, which I am now getting call logs returned to me but how do I loop through the results and just get the name of the person who made the call and a count of how many calls they made.
Here is my code so far.
rc = new RestClient(appKey, appSecret, isProduction);
await rc.Authorize(userName, "", password);
var mainAccount = rc.Restapi().Account();
DateTime input = DateTime.Today;
int delta = DayOfWeek.Monday - input.DayOfWeek;
DateTime monday = input.AddDays(delta);
var extension2 = rc.Restapi().Account().Extension();
var callLogs = await mainAccount.CallLog().List(new { dateFrom = monday.ToString("yyyy-MM-dd") });
string id = string.Empty;
var query = callLogs.records.SelectMany(x => x.from.name)
.GroupBy(s => s)
.Select(g => new { Name = g.Key, Count = g.Count() });
//var query = callLogs.records.SelectMany(x => x.id)
// .GroupBy(s => s)
// .Select(g => new { Name = g.Key, Count = g.Count() });
foreach (var result in query)
{
Console.WriteLine("Name: {0}, Count: {1}", result.Name, result.Count);
}
Thanks for helping,
Keith.