protected override void ExecuteWorkImplementation() { var filteringExpressionSet = m_filteringExpressionSetRepository.FindById <FilteringExpressionSet>(m_filteringExpressionSetId); if (filteringExpressionSet == null) { throw new MainServiceException(MainServiceErrorCode.EntityNotFound, "The entity was not found."); } var bibliographicFormat = m_filteringExpressionSetRepository.Load <BibliographicFormat>(m_data.BibliographicFormat.Id); filteringExpressionSet.Name = m_data.Name; filteringExpressionSet.BibliographicFormat = bibliographicFormat; filteringExpressionSet.FilteringExpressions.Clear(); var list = m_data.FilteringExpressions.Select(x => new FilteringExpression { Field = x.Field, Value = x.Value, FilteringExpressionSet = filteringExpressionSet }).ToList(); foreach (var expression in list) { filteringExpressionSet.FilteringExpressions.Add(expression); } m_filteringExpressionSetRepository.Update(filteringExpressionSet); }
protected override void ExecuteWorkImplementation() { var filteringExpressionSet = m_filteringExpressionSetRepository.Load <FilteringExpressionSet>(m_filteringExpressionSetId); if (filteringExpressionSet == null) { throw new MainServiceException(MainServiceErrorCode.EntityNotFound, "The entity was not found."); } m_filteringExpressionSetRepository.Delete(filteringExpressionSet); }
protected override int ExecuteWorkImplementation() { var bibliographicFormat = m_filteringExpressionSetRepository.Load <BibliographicFormat>(m_data.BibliographicFormat.Id); var user = m_filteringExpressionSetRepository.Load <User>(m_userId); var filteringExpressionSet = new FilteringExpressionSet { Name = m_data.Name, CreatedByUser = user, BibliographicFormat = bibliographicFormat, }; filteringExpressionSet.FilteringExpressions = m_data.FilteringExpressions.Select(x => new FilteringExpression { Field = x.Field, Value = x.Value, FilteringExpressionSet = filteringExpressionSet }).ToList(); var resultId = (int)m_filteringExpressionSetRepository.Create(filteringExpressionSet); return(resultId); }