34 lines
813 B
C#
34 lines
813 B
C#
|
using BlueWest.Data.Application.Users;
|
||
|
using BlueWest.Data.Auth;
|
||
|
using BlueWest.Views.Models;
|
||
|
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||
|
|
||
|
namespace BlueWest.Views.Utils;
|
||
|
|
||
|
public static class DataUtil
|
||
|
{
|
||
|
public static ApplicationUserUnique GetUserViewData(this ViewDataDictionary viewData)
|
||
|
{
|
||
|
if (viewData[UserViewDataId] is ApplicationUserUnique user)
|
||
|
{
|
||
|
return user;
|
||
|
}
|
||
|
|
||
|
return null!;
|
||
|
}
|
||
|
|
||
|
public static IpInformation GetIpInformation(this ViewDataDictionary viewData)
|
||
|
{
|
||
|
if (viewData[IpViewStorage] is IpInformation ipInformation)
|
||
|
{
|
||
|
return ipInformation;
|
||
|
}
|
||
|
|
||
|
return null!;
|
||
|
}
|
||
|
|
||
|
public static string GetRootUrl(this ViewDataDictionary viewData)
|
||
|
{
|
||
|
return SessionConstants.CookieDomain;
|
||
|
}
|
||
|
}
|