public IHttpActionResult CreateGraphJsonData(int id)
        {
            var serviceDescription = _serviceDescriptionService.Get(id, withSawsdlModelReference: true);

            if (serviceDescription == null)
            {
                return(NotFound());
            }

            var response = _graphService.CreateGraphData(serviceDescription.Id, serviceDescription.ServiceName, serviceDescription.WsdlInterfaces);

            return(Ok(response));
        }
Пример #2
0
        public void AcceptInvitationForExistingUser(ShareInvitation shareInvitation, User user)
        {
            var shareInvitations = _shareInvitationRepository.GetAll()
                                   .Where(x => x.Email == shareInvitation.Email.ToLower() && x.InvitationStatus == InvitationStatusEnum.Invited).ToList();

            user.ServiceDescription_Users = new List <ServiceDescription_User>();

            foreach (var item in shareInvitations)
            {
                //Update the invitation status to Accepted
                item.InvitationStatus = InvitationStatusEnum.Accepted;

                //Update the entity with the new invitation status in the EF context
                _shareInvitationRepository.Update(item);

                //Get the service description according to the service description id in the input parameters
                var serviceDescription = _serviceDescriptionRepository.GetComplete(item.IdServiceDescription);

                //Generate the graph (original) for the service description
                var graphJson = _graphService.CreateGraphData(serviceDescription.Id, serviceDescription.ServiceName, serviceDescription.WsdlInterfaces);

                //Generate the service description for the (invited) shared user
                var serviceDescription_User = new ServiceDescription_User
                {
                    IdServiceDescription = item.IdServiceDescription,
                    IdSharedUser         = user.Id
                };

                //Add the link between the (invited) shared user and the service description
                _serviceDescription_UserRepository.Create(serviceDescription_User);
            }

            //Update the (invited) shared user in the database via the EF context
            _serviceDescription_UserRepository.SaveChanges();

            //Save the updated invitation, with new status, in the database via the EF context
            _shareInvitationRepository.SaveChanges();
        }