public ActionResult Edit(PreviewEmployeePaycheckViewModel paycheckViewModel)
 {
     if (this.ModelState.IsValid)
     {
         var employeePaycheck = this.mapService.Map <EmployeePaycheck>(paycheckViewModel);
         employeePaycheck.EmployeeId = paycheckViewModel.EmployeeId;
         this.employeePaycheckService.UpdateById(employeePaycheck.Id, employeePaycheck);
         return(RedirectToAction("Details", "Employees", new { id = employeePaycheck.EmployeeId }));
     }
     return(View(paycheckViewModel));
 }
        public ActionResult CreateLaborContract(int id, PreviewEmployeePaycheckViewModel laborContractModel)
        {
            var grossSalary = laborContractModel.GrossSalary + laborContractModel.GrossFixedBonus + laborContractModel.GrossNonFixedBonus;
            var isMaxSSI    = this.calculate.CheckMaxSocialSecurityIncome(grossSalary);

            laborContractModel.SocialSecurityIncome = isMaxSSI ? ValidationConstants.MaxSocialSecurityIncome : grossSalary;
            laborContractModel.PersonalInsurance    = this.calculate.GetPersonalInsurance(grossSalary);
            laborContractModel.IncomeTax            = this.calculate.GetIncomeTax(grossSalary, laborContractModel.PersonalInsurance);
            laborContractModel.NetWage    = this.calculate.GetNetWage(grossSalary, laborContractModel.PersonalInsurance, laborContractModel.IncomeTax);
            laborContractModel.EmployeeId = id;
            var employee = this.employeeService.GetById(id);

            laborContractModel.EmployeeFullName = employee.FirstName + " " + employee.MiddleName + " " + employee.LastName;

            if (this.ModelState.IsValid)
            {
                var paycheck = this.mapService.Map <EmployeePaycheck>(laborContractModel);
                this.employeePaycheckService.Create(paycheck);
                return(View("Details", laborContractModel));
            }

            return(View(laborContractModel));
        }
        public ActionResult DeleteConfirmed(int id, PreviewEmployeePaycheckViewModel paycheckViewModel)
        {
            this.employeePaycheckService.DeleteById(id);

            return(RedirectToAction("Index", "Employees"));
        }