Exemple #1
0
        protected override int ExecuteWorkImplementation()
        {
            var literaryOriginal = m_originalId != null
                ? m_catalogValueRepository.FindById <LiteraryOriginal>(m_originalId.Value)
                : new LiteraryOriginal();

            if (literaryOriginal == null)
            {
                throw new MainServiceException(MainServiceErrorCode.EntityNotFound, "The entity was not found.");
            }

            literaryOriginal.Name = m_name;

            m_catalogValueRepository.Save(literaryOriginal);

            return(literaryOriginal.Id);
        }
Exemple #2
0
        protected override int ExecuteWorkImplementation()
        {
            var keywordEntity = m_keywordId != null
                ? m_catalogValueRepository.FindById <Keyword>(m_keywordId.Value)
                : new Keyword();

            if (keywordEntity == null)
            {
                throw new MainServiceException(MainServiceErrorCode.EntityNotFound, "The entity was not found.");
            }

            keywordEntity.Text = m_name;

            m_catalogValueRepository.Save(keywordEntity);

            return(keywordEntity.Id);
        }
        protected override int ExecuteWorkImplementation()
        {
            var termCategory = m_termCategoryId != null
                ? m_catalogValueRepository.FindById <TermCategory>(m_termCategoryId.Value)
                : new TermCategory();

            if (termCategory == null)
            {
                throw new MainServiceException(MainServiceErrorCode.EntityNotFound, "The entity was not found.");
            }

            termCategory.Name = m_data.Name;

            m_catalogValueRepository.Save(termCategory);

            return(termCategory.Id);
        }
Exemple #4
0
        protected override void ExecuteWorkImplementation()
        {
            var item = m_catalogValueRepository.FindById <Term>(m_termId);

            if (item == null)
            {
                throw new MainServiceException(MainServiceErrorCode.EntityNotFound, "The entity was not found.");
            }

            try
            {
                m_catalogValueRepository.Delete(item);
                m_catalogValueRepository.UnitOfWork.CurrentSession.Flush();
            }
            catch (GenericADOException)
            {
                throw new MainServiceException(MainServiceErrorCode.DeleteResourcePageRelation, "Could not delete resource. Existing relation to resource Page?");
            }
        }
        protected override int ExecuteWorkImplementation()
        {
            var responsibleType = m_responsibleTypeId != null
                ? m_catalogValueRepository.FindById <ResponsibleType>(m_responsibleTypeId.Value)
                : new ResponsibleType();

            if (responsibleType == null)
            {
                throw new MainServiceException(MainServiceErrorCode.EntityNotFound, "The entity was not found.");
            }

            var typeEnum = m_mapper.Map <ResponsibleTypeEnum>(m_data.Type);

            responsibleType.Text = m_data.Text;
            responsibleType.Type = typeEnum;

            m_catalogValueRepository.Save(responsibleType);

            return(responsibleType.Id);
        }