public async Task <IActionResult> Post([FromBody] BorrowingProfileFilter filter) { if (filter == null) { filter = BorrowingProfileFilter.Default; } var vm = new BorrowingProfileViewModel { Filter = filter, Fiscals = FiscalYear.GetFiscals() }; var fiscalYear = new FiscalYear(filter.StartFiscalYear); vm.Profiles = await _facade.GetProfilesDataAsync(filter); vm.Target = await _facade.GetTargetAsync(fiscalYear); vm.Hedges = await _facade.GetHedgesAsync(filter); if (vm.Profiles != null) { vm.ProfilesTotals = ProfileCalculator.CalculateTotals(vm.Profiles, vm.Target, fiscalYear); vm.ElapsedTime = ProfileCalculator.CalculateTimeElapsed(fiscalYear); } return(Ok(vm)); }