コード例 #1
0
        public async Task <IActionResult> Post(RoundDateForAddDto model)
        {
            var activeRound = _roundDatesService.GetActiveRound();

            if (activeRound != null)
            {
                activeRound.IsActive = false;
            }

            RoundDate round = mapper.Map <RoundDate>(model);
            await _roundDatesService.AddRound(round);

            return(Ok());
        }
コード例 #2
0
        public decimal CalculateProratedContribution(decimal contribution)
        {
            var roundDate      = _roundDatesService.GetActiveRound();
            var roundStartDate = roundDate.StartDate;
            int year;

            if (roundStartDate.Month > 7)
            {
                year = roundStartDate.Year;
            }
            else
            {
                year = roundStartDate.Year - 1;
            }

            var fixedDate = new DateTime(year, 7, 1);

            var days   = roundStartDate - fixedDate;
            var months = days.Days / 30;

            var proratedContribution = (contribution / 12) * months;

            return(proratedContribution);
        }