public void LeaveRulesCreate(LeaveRulesDTOs Record) { try { using (var scope = new System.Transactions.TransactionScope()) { LeaveRule test = _unitOfWork.LeaveRuleRepository.Create(LeaveRulesMapper.LeaveRuleDtoToLeaveRules(Record)); int count = Record.LeaveRuleDetailsColection.Count(); for (int i = 0; i < count; i++) { LeaverulesDetailsDtos data = new LeaverulesDetailsDtos(); data.LeaveRuleId = test.LeaveRuleId; data.LeaveTypeId = Record.LeaveRuleDetailsColection[i].LeaveTypeId; if (Record.LeaveRuleDetailsColection[i].LeaveDays == null) { data.LeaveDays = 0; } data.LeaveDays = Record.LeaveRuleDetailsColection[i].LeaveDays; LeaveRuleDetail insertdata = LeaveRuleDetailsMapper.LeaveRulesdetailDtoToLeaveRuleDetails(data); _unitOfWork.LeaveRuleDetailRepository.Create(insertdata); } scope.Complete(); } } catch (TransactionAbortedException ex) { throw new Exception(ex.Message); } catch (ApplicationException ex) { throw new Exception(ex.Message); } }
public IEnumerable <LeaverulesDetailsDtos> LeaveRulesDetailsList() { List <LeaveRuleDetail> Data = _unitOfWork.LeaveRuleDetailRepository.All().ToList(); return(LeaveRuleDetailsMapper.LeaveRuleDetailListToLeaveRuleDetailsDto(Data)); }