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()); }
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); }