Exemplo n.º 1
0
        /// <summary>
        /// Deactivates the specified link.
        /// </summary>
        /// <param name="link">The link.</param>
        /// <returns>ILink.</returns>
        public ILink Deactivate(ILink link)
        {
            var clt = CreateClient();

            try
            {
                return(clt.Deactivate(link.Zip()).Unzip <Link>());
            }
            catch (Exception ex)
            {
                Logger.Error(ex.GetCombinedMessages());
                link.AddError(ex.GetCombinedMessages());
                return(link);
            }
            finally
            {
                CloseClient(clt);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the sources.
        /// </summary>
        /// <param name="link">The link.</param>
        /// <param name="activeOnly">if set to <c>true</c> [active only].</param>
        /// <returns>IEnumerable&lt;ILink&gt;.</returns>
        public IEnumerable <ILink> GetSources(ILink link, bool activeOnly = true)
        {
            var clt = CreateClient();

            try
            {
                return(clt
                       .GetSources(link.Zip(), activeOnly)
                       .Unzip <Link>());
            }
            catch (Exception ex)
            {
                Logger.Error(ex.GetCombinedMessages());
                link.AddError(ex.GetCombinedMessages());
                return(new[] { link });
            }
            finally
            {
                CloseClient(clt);
            }
        }