using AsbCloudDb.Model; using System.Security.Claims; namespace AsbCloudWebApi { public static class Extensions { public static int? GetCustomerId(this ClaimsPrincipal user) { var claimIdCustomer = user.FindFirst(nameof(User.IdCustomer)); if (claimIdCustomer is null) return null; return int.TryParse(claimIdCustomer.Value, out int uid) ? uid : null; } } }