public void Handle(AddDeductionsSalaryCommand command) { var employee = new B_Employee(); employee.SetId(command.SalaryDeductionsDto.EmployeeId); var value = new B_SalaryDeductions() { Employee = employee, Amount = command.SalaryDeductionsDto.Amount, FromDate = command.SalaryDeductionsDto.FromDate, ToDate = command.SalaryDeductionsDto.ToDate, SalaryDeductionsType = (SalaryDeductionsType)command.SalaryDeductionsDto.SalaryDeductionsType, ContractNumber = command.SalaryDeductionsDto.ContractNumber, FirstInstallmentCapital = command.SalaryDeductionsDto.FirstInstallmentCapital, FirstInstallmentInterest = command.SalaryDeductionsDto.FirstInstallmentInterest, MonthlyCycle = command.SalaryDeductionsDto.MonthlyCycle, RegistrationNumber = command.SalaryDeductionsDto.RegistrationNumber }; SalaryDeductionsRepository.Save(value, command.SalaryDeductionsDto.UserId); command.ReturnValue = value.Id; command.Success = true; }
public int AddDeductionsSalary(SalaryDeductionsDto salaryDeductionsDto) { var employee = new B_Employee(); employee.SetId(salaryDeductionsDto.EmployeeId); var value = new B_SalaryDeductions() { Employee = employee, Amount = salaryDeductionsDto.Amount, FromDate = salaryDeductionsDto.FromDate, ToDate = salaryDeductionsDto.ToDate, SalaryDeductionsType = (SalaryDeductionsType)salaryDeductionsDto.SalaryDeductionsType, ContractNumber = salaryDeductionsDto.ContractNumber, FirstInstallmentCapital = salaryDeductionsDto.FirstInstallmentCapital, FirstInstallmentInterest = salaryDeductionsDto.FirstInstallmentInterest, MonthlyCycle = salaryDeductionsDto.MonthlyCycle, RegistrationNumber = salaryDeductionsDto.RegistrationNumber }; SalaryDeductionsRepository.SaveAndFlush(value, salaryDeductionsDto.UserId); return(value.Id); }