Exemplo n.º 1
0
        public async Task <Month <T> > GetMonthAsync(int monthId)
        {
            var(year, month) = MonthUtil.ParseMonthId(monthId);
            var values = await MultipleAsync(x =>
                                             x.Year == year && x.MonthId == monthId);

            return(new Month <T>(monthId, values));
        }
Exemplo n.º 2
0
        public async Task <Month <INamedBalance> > GetMonthCategoriesAsync(int monthId)
        {
            var(year, month) = MonthUtil.ParseMonthId(monthId);
            var transactions = await MultipleAsync(x =>
                                                   x.Year == year && x.MonthId == monthId);

            var categories = transactions.GroupBy(x => x.Category)
                             .Select(g => new CategoryBalance(g.Key, g.Sum(x => x.Amount), monthId));

            return(new Month <INamedBalance>(monthId, categories));
        }