Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="idOntology"></param>
        /// <param name="idServiceDescription"></param>
        public void AddOntologyToSharedUsersSync(int idOntology, int idServiceDescription)
        {
            var sharedUsers = _serviceDescription_UserRepository.GetAllByServiceDescription(idServiceDescription).ToList();
            //var sharedUsers = _serviceDescription_UserService.GetAllByServiceDescription(IdServiceDescription);

            var idSharedUsers = sharedUsers.Select(x => x.IdSharedUser);

            AddOntologyToSharedUsers(idOntology, idSharedUsers);
        }
Ejemplo n.º 3
0
 public List <ServiceDescription_User> GetAllByServiceDescription(int idServiceDescription)
 {
     return(_serviceDescription_UserRepository.GetAllByServiceDescription(idServiceDescription).ToList());
 }