public async Task <IActionResult> Create(PaymentRecordCreateViewModel viewModel) { if (ModelState.IsValid) { var payRecord = new PaymentRecord { Id = viewModel.Id, EmployeeId = viewModel.EmployeeId, FullName = _employeeService.GetById(viewModel.Id).FullName, NiNo = viewModel.NiNo, PayDate = viewModel.PayDate, PayMonth = viewModel.PayMonth, TaxYearId = viewModel.TaxYearId, TaxCode = viewModel.TaxCode, HourlyRate = viewModel.HourlyRate, HoursWorked = viewModel.HoursWorked, ContractualHours = viewModel.ContractualHours, OvertimeHours = _overTimeHours = _payComputationServie.OvertimeHours(viewModel.HoursWorked, viewModel.ContractualHours), ContractualEarnings = _contractualEarnings = _payComputationServie.ContractualEarning(viewModel.ContractualHours, viewModel.HoursWorked, viewModel.HourlyRate), OvertimeEarnings = _overtimeEarnings = _payComputationServie.OvertimeEarnings(_payComputationServie.OvertimeRate(viewModel.HourlyRate), _overTimeHours), TotalEarnings = _totalEarnings = _payComputationServie.TotalEarnings(_overtimeEarnings, _contractualEarnings), Tax = _tax = _taxService.TaxAmount(_totalEarnings), UnionFee = _unionFee = _employeeService.UnionFees(viewModel.Id), SLC = _slc = _employeeService.StudentLoanRepaymentAmount(viewModel.Id, _totalEarnings), NIC = _nic = _nationalInsuranceContributionService.NIContribution(_totalEarnings), TotalDeduction = _totalDeduction = _payComputationServie.TotalDeduction(_tax, _nic, _slc, _unionFee), NetPayment = _payComputationServie.NetPay(_totalEarnings, _totalDeduction) }; await _payComputationServie.CreateAsync(payRecord); return(RedirectToAction(nameof(Index))); } ViewBag.employees = _employeeService.GetAllEmployeesForPayRoll(); ViewBag.taxYears = _payComputationServie.GetAllTaxYear(); return(View()); }