Exemplo n.º 1
0
        /// <summary>
        /// Creates a new term relationship
        /// </summary>
        /// <param name="objectId">Id of the object</param>
        /// <param name="taxonomyId">Id of the taxonomy</param>
        /// <returns>Newly created TermRelationship object</returns>
        public TermRelationship CreateTermRelationship(int objectId, int taxonomyId)
        {
            var taxonomyExists = _taxonomyRepository.Any(taxonomyId);

            if (!taxonomyExists)
            {
                throw new ArgumentException($"No taxonomy found for specific id = {taxonomyId}", nameof(taxonomyId));
            }

            var termRelationship = new TermRelationship()
            {
                ObjectId   = objectId,
                TaxonomyId = taxonomyId
            };

            _termRelationshipRepository.Create(termRelationship);

            return(termRelationship);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a new term relationship
 /// </summary>
 /// <param name="termRelationship">Term Relationship object to be created</param>
 public void CreateTermRelationship(TermRelationship termRelationship)
 {
     _termRelationshipRepository.Create(termRelationship);
 }