DD.WellWorkover.Cloud/AsbCloudWebApi/Extensions.cs
2021-07-21 12:48:37 +05:00

20 lines
481 B
C#

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.IdCompany));
if (claimIdCustomer is null)
return null;
return int.TryParse(claimIdCustomer.Value, out int uid)
? uid
: null;
}
}
}