コード例 #1
0
        public IActionResult Index()
        {
            var payRecords = _payComputationServie.GetAll().Select(pay => new PaymentRecordIndexViewModel
            {
                Id             = pay.Id,
                EmployeeId     = pay.EmployeeId,
                FullName       = pay.FullName,
                PayDate        = pay.PayDate,
                PayMonth       = pay.PayMonth,
                TaxYearId      = pay.TaxYearId,
                Year           = _payComputationServie.GetTaxYearById(pay.TaxYearId).YearOfTax,
                TotalEarnings  = pay.TotalEarnings,
                TotalDeduction = pay.TotalDeduction,
                Employee       = pay.Employee
            });

            return(View(payRecords));
        }
コード例 #2
0
ファイル: PayController.cs プロジェクト: cShark-dev/Payway3
        public IActionResult Index()
        {
            var payRecords = _payComputationService.GetAll().Select(pay => new PaymentRecordIndexViewModel
            {
                Id             = pay.Id,
                EmployeeId     = pay.EmployeeId,
                FullName       = pay.FullName,
                PayDate        = pay.PayDate,
                PayMonth       = pay.PayMonth,
                TaxYearId      = pay.TaxYearId,
                Year           = _payComputationService.GetTaxYearById(pay.TaxYearId).YearOfTax,       //We need to write a method in the PayComputationService and pass this id to that method
                TotalEarnings  = pay.TotalEarnings,
                TotalDeduction = pay.TotalDeduction,
                NetPayment     = pay.NetPayment,
                Employee       = pay.Employee,
            });

            return(View(payRecords));          //We need a view model for this index, right click models add new model
        }
コード例 #3
0
ファイル: PayController.cs プロジェクト: dimjb/PayCompute
        public async Task <IActionResult> Index()
        {
            var payRecords = await _payComputationService.GetAll();

            var payRecordsToView = payRecords.Select(pay => new PaymentRecordIndexViewModel
            {
                Id             = pay.Id,
                EmployeeId     = pay.EmployeeId,
                FullName       = pay.FullName,
                PayDate        = pay.PayDate,
                PayMonth       = pay.PayMonth,
                TaxYearId      = pay.TaxYearId,
                Year           = _payComputationService.GetTaxYearById(pay.TaxYearId).Result.YearOfTax,
                TotalEarnings  = pay.TotalEarnings,
                TotalDeduction = pay.TotalDeduction,
                NetPayment     = pay.NetPayment,
                Employee       = pay.Employee
            });

            return(View(payRecordsToView));
        }