예제 #1
0
        public IList<BalancePerMonth> GetBalancePerMonth(string from, string to)
        {
            var dateFrom = DateTime.ParseExact(from, "yyyyMMdd", CultureInfo.InvariantCulture);
            var dateTo = DateTime.ParseExact(to, "yyyyMMdd", CultureInfo.InvariantCulture);

            var transactionManager = new BalanceManager();
            return transactionManager.GetBalancePerMonth(dateFrom, dateTo);
        }
예제 #2
0
        public dynamic GetDates()
        {
            var transactionManager = new BalanceManager();

            DateTime? dateFrom, dateTo;
            transactionManager.GetBalanceDates(out dateFrom, out dateTo);

            if (dateFrom.HasValue && dateTo.HasValue)
                return new
                {
                    FirstDate = dateFrom.Value,
                    LastDate = dateTo.Value
                };

            return null;
        }
예제 #3
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();
        }