/// <summary>
        /// Ermittelt die ID-Information aus der Informationssammlung
        /// </summary>
        /// <param name="information">Informationssammlung</param>
        /// <returns>ID-Information</returns>
        public static string GetId(this Dictionary<string, IEnumerable<string>> information)
        {
            var id = default(string);

            var idexpressions = new[] { ".id", "id" };
            var ids =
                information != null ?
                information?.FirstOrDefault(entry => idexpressions.Any(expression => entry.Key.ToLower().EndsWith(expression))) :
                default(KeyValuePair<string, IEnumerable<string>>)
            ;
            id = ids?.Value?.FirstOrDefault() ?? string.Empty;

            return id;
        }
Example #2
0
 public static FindContentResult TakeTemplateResult(this IEnumerable<FindContentResult> contents)
 {
     return contents?.FirstOrDefault(c => c.Content is Template);
 }
Example #3
0
 public static string GithubTokenOrDefault(this IEnumerable<Claim> claims)
 {
     return claims?
        .FirstOrDefault(a => a.Issuer.Equals("GitHub", StringComparison.OrdinalIgnoreCase) && a.Type.Equals("access_token", StringComparison.OrdinalIgnoreCase))?.Value;
 }
Example #4
0
 public static FindContentResult TakeRedirectResult(this IEnumerable<FindContentResult> contents)
 {
     return contents?.FirstOrDefault(c => c.Content is Redirect);
 }