Пример #1
0
        public int CreateBySharedServiceDescription(int idServiceDescription, int idOntologyTerm)
        {
            var usersWithWhomTheServiceDescriptionIsShared = _serviceDescription_UserEntityRepository.GetAllByServiceDescription(idServiceDescription);

            if (usersWithWhomTheServiceDescriptionIsShared.Any())
            {
                var idOntology = _ontologyTermEntityRepository.Get(idOntologyTerm).IdOntology;

                Ontology_User ontologyUser;

                foreach (var shared in usersWithWhomTheServiceDescriptionIsShared)
                {
                    if (!CheckIfOntologyIsAlreadySharedWithUser(shared.IdSharedUser))
                    {
                        ontologyUser = new Ontology_User {
                            IdOntology = idOntology, IdSharedUser = shared.IdSharedUser
                        };

                        _ontology_UserRepository.Create(ontologyUser);
                    }
                }

                return(_ontology_UserRepository.SaveChanges());
            }

            return(0);
        }
Пример #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="idOntologyTerm"></param>
 /// <returns></returns>
 public OntologyTerm GetOntologyTerm(int idOntologyTerm)
 {
     return(_ontologyTermRepository.Get(idOntologyTerm));
 }