Example #1
0
        public async Task AddOrUpdateHsa(Hsa hsaMessage)
        {
            var hsa = await _payrollRepository.GetHsaByEmployee(hsaMessage.EmployeeId);

            if (hsa != null)
            {
                hsa.ContributionAmount = hsaMessage.ContributionAmount;
                await _payrollRepository.UpdateHsa(hsa);
            }
            else
            {
                hsa = new Hsa
                {
                    ContributionAmount = hsaMessage.ContributionAmount,
                    EmployeeId         = hsaMessage.EmployeeId
                };

                await _payrollRepository.CreateHsa(hsa);
            }
        }