Exemplo n.º 1
0
        public ServiceResponse <int> UpdateTemplateProperty(TemplatePropertyDto templatePropertyDto)
        {
            if (templatePropertyDto == null)
            {
                throw new ServiceException(Translate(MessagesConstants.ERR_DATA_NOT_FOUND_TO_SAVE));
            }

            TemplateProperty entity = new TemplateProperty();
            var Rm           = new RepositoryManager(ServiceContext);
            int rowsAffected = Rm.TemplatePropertyRepository.Update(entity.CopyFrom(templatePropertyDto));

            if (rowsAffected > 0)
            {
                return(new ServiceResponse <int>(rowsAffected, Translate(MessagesConstants.SCC_DATA_UPDATED)));
            }
            throw new ServiceException(Translate(MessagesConstants.ERR_UPDATE));
        }
Exemplo n.º 2
0
        public ServiceResponse <long> InsertTemplateProperty(TemplatePropertyDto templatePropertyDto)
        {
            if (templatePropertyDto == null)
            {
                throw new ServiceException(Translate(MessagesConstants.ERR_DATA_NOT_FOUND_TO_SAVE));
            }

            TemplateProperty entity = new TemplateProperty();
            var  Rm = new RepositoryManager(ServiceContext);
            long id = Rm.TemplatePropertyRepository.Insert(entity.CopyFrom(templatePropertyDto));

            if (id > 0)
            {
                return(new ServiceResponse <long>(id, Translate(MessagesConstants.SCC_DATA_INSERTED)));
            }
            throw new ServiceException(Translate(MessagesConstants.ERR_INSERT));
        }