public async Task <IActionResult> ReviewPaychecks(ReviewPaychecksViewModel model) { if (!ModelState.IsValid) { return(View(await ReviewPaychecksViewModel.ReBuildAsync(model, this.PayrollService))); } if (!this.PayrollService.TryParsePeriod(model.From, out DateTime dateFrom) || !this.PayrollService.TryParsePeriod(model.To, out DateTime dateTo, false) || dateFrom.Date >= dateTo.Date) { ModelState.AddModelError( string.Empty, $"Invalid dates. Make sure the end period date is later then the start date. Try again and if the problem persist contact administrator."); return(View(await ReviewPaychecksViewModel.ReBuildAsync(model, this.PayrollService))); } return(View(await ReviewPaychecksViewModel.CreateAsync(model, dateFrom, dateTo, this.PayrollService, this.Mapper))); }
public async Task <IActionResult> ReviewPaychecks() { return(View(await ReviewPaychecksViewModel.CreateAsync(this.PayrollService))); }