34 lines
819 B
C#
34 lines
819 B
C#
using BlueWest.Data.Application.Users;
|
|
using BlueWest.Data.Auth;
|
|
using CodeLiturgy.Views.Models;
|
|
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
|
|
|
namespace CodeLiturgy.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;
|
|
}
|
|
} |