Пример #1
0
        public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        {
            // Uninstall the instance.
            //NodeServiceInstance serviceInstance = SPFarm.Local.Services.GetValue<NodeServiceInstance>();
            foreach (SPServer server in SPFarm.Local.Servers)
            {
                if (server.Role != SPServerRole.Invalid)
                {
                    NodeServiceInstance serviceInstance = server.ServiceInstances.GetValue <NodeServiceInstance>();

                    if (serviceInstance != null)
                    {
                        serviceInstance.Delete();
                    }
                }
            }

            // Uninstall the service proxy.
            NodeServiceProxy serviceProxy = SPFarm.Local.ServiceProxies.GetValue <NodeServiceProxy>();

            if (serviceProxy != null)
            {
                serviceProxy.Delete();
            }

            // Uninstall the service.
            NodeService service = SPFarm.Local.Services.GetValue <NodeService>();

            if (service != null)
            {
                service.Delete();
            }
        }
Пример #2
0
        public IActionResult Delete(int id)
        {
            var node = _service.GetById(id);

            _service.Delete(node);
            return(new JsonResult(node));
        }
Пример #3
0
        public async Task <bool> DeleteNode([Required] Guid id,
                                            [GlobalState("ClaimsPrincipal")] ClaimsPrincipal user)
        {
            var auth =
                await authorizationService.AuthorizeAsync(user, id,
                                                          new TenantNodeRequirement());

            if (auth.Failure != null)
            {
                throw new UnauthorizedAccessException();
            }

            await nodeService.Delete(id);

            return(true);
        }