Example #1
0
        private static async Task PrintData(ISaveItService service)
        {
            var user = (await service.Users.GetAllAsync()).Single();

            Console.WriteLine("User:"******"Accounts:");
            Console.WriteLine(JsonConvert.SerializeObject(accounts, Formatting.Indented));

            var category = (await service.Categories.GetAllAsync(user.Id)).Single();

            Console.WriteLine("Category:");
            Console.WriteLine(JsonConvert.SerializeObject(category, Formatting.Indented));

            var people = await service.People.GetAllAsync(user.Id);

            Console.WriteLine("People:");
            Console.WriteLine(JsonConvert.SerializeObject(people, Formatting.Indented));

            var accountTransactions = await service.AccountTransactions.GetAllAsync(user.Id);

            var sampleTransaction = accountTransactions.Where(x => x.Transactions.Sum(t => t.Amount) > 0).First();

            Console.WriteLine("Paychecks:");
            Console.WriteLine(JsonConvert.SerializeObject(sampleTransaction, Formatting.Indented));

            // var transactions = accountTransactions.SelectMany(t => t.Transactions);

            // var totalsByPerson = transactions
            //                 .GroupBy(t => t.PersonId)
            //                 .Select(g => new
            //                 {
            //                     Name = g.First().Person.Name,
            //                     Total = g.Sum(x => x.Amount)
            //                 }).ToList();

            // Console.WriteLine("Totals by Person:");
            // Console.WriteLine(JsonConvert.SerializeObject(totalsByPerson, Formatting.Indented));
        }
Example #2
0
        public static void Main(string[] args)
        {
            ISaveItService service = GetInMemoryService().Result;

            PrintData(service).Wait();
        }