DD.WellWorkover.Cloud/AsbCloudWebApi/Extensions.cs
2021-07-21 15:22:58 +05:00

20 lines
477 B
C#

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