Esempio n. 1
0
        public async Task <IMonthDao> HandleAsync(GetMonthByIdCommand command)
        {
            var monthDto = MonthDto.SetMonthId(command.monthId);
            var month    = await _monthDal.GetMonthByIdAsync(monthDto);

            return(month);
        }
Esempio n. 2
0
        /// <summary>
        /// Gets a months by its identifiyer
        /// </summary>
        /// <returns>A new instance of <see cref="IMonthDao"/></returns>
        public async Task <IMonthDao> GetMonthByIdAsync(MonthDto monthDto)
        {
            IMonthDao month = null;

            using (var connection = _connectionProvider())
            {
                month = await connection.QueryFirstAsync <MonthDao>(
                    MonthsQueries.GetMonthById,
                    new { monthID = monthDto.MonthId },
                    commandType : CommandType.StoredProcedure
                    ).ConfigureAwait(false);
            }

            return(month);
        }
        /// <summary>
        /// Gets the calendar month for the given year and month.
        /// </summary>
        /// <param name="year">Year.</param>
        /// <param name="month">Month.</param>
        /// <returns>The <see cref="Task{MonthDto}"/> instance.</returns>
        public async Task <MonthDto> GetCalendarMonthAsync(int?year, int?month)
        {
            if (!year.HasValue)
            {
                throw new ArgumentException("Value must not be null.", nameof(year));
            }

            IEnumerable <Holiday> holidays = await Repository.GetHolidaysAsync(year, month);

            IEnumerable <CalendarDayDto> resultDto = GetDates(year, month);

            MonthDto monthDto = new MonthDto().MapFrom(year, month, resultDto, holidays);

            return(monthDto);
        }
        public IActionResult GetMonthDetails(Guid MonthId)
        {
            MonthDto month = _logic.GetMonthDetails(MonthId);

            List <Income> monthIncomes = _logic.GetMonthIncomes(month.StartOfMonth, month.EndOfMonth);

            List <Expense> monthExpenses = _logic.GetMonthExpenses(month.StartOfMonth, month.EndOfMonth);

            DashboardViewModel model = new DashboardViewModel()
            {
                MonthIncomes  = monthIncomes,
                MonthExpenses = monthExpenses
            };

            return(View(model));
        }