Ejemplo n.º 1
0
        public dynamic GetBalancePerCategory(string from, string to, string balanceType)
        {
            var dateFrom = DateTime.ParseExact(from, "yyyyMMdd", CultureInfo.InvariantCulture);
            var dateTo = DateTime.ParseExact(to, "yyyyMMdd", CultureInfo.InvariantCulture);
            var type = (BalanceType)Enum.Parse(typeof(BalanceType), balanceType, true);

            var transactionManager = new BalanceManager();
            return transactionManager.GetBalancePerCategory(dateFrom, dateTo, type)
                .Select(x => new
                {
                    CategoryId = x.Category.Id,
                    CategoryName = x.Category.Name,
                    Amount = x.Amount
                })
                .ToList();
        }