public void CopySalary(int sourceId) { var sourceSalary = _salaryRepository.GetById(sourceId, true); var copySalary = Mapper.Map <Salary>(sourceSalary); copySalary.Description = "Copy " + copySalary.Description; copySalary = _salaryRepository.Create(copySalary); var sourceSalaryDeductions = _salaryDeductionRepository.GetListAsNoTracking().Where(x => x.SalaryId == sourceId).ToList(); foreach (var sourceSalaryDeduction in sourceSalaryDeductions) { var copySalaryDeduction = Mapper.Map <SalaryDeduction>(sourceSalaryDeduction); copySalaryDeduction.SalaryId = copySalary.Id; _salaryDeductionRepository.Create(copySalaryDeduction); } }
public ActionResult Get(Guid id) { var salary = _repo.GetById(id); return(Ok(salary)); }