34 lines
825 B
C#
34 lines
825 B
C#
using CodeLiturgy.Data.Application.Users;
|
|
using CodeLiturgy.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;
|
|
}
|
|
} |