Author : MD TAREQ HASSAN | Updated : 2020/08/28
AuthenticationStateExtension
Uses : AuthUtil
Extensions/AuthenticationStateExtension.cs
using AzureAppServiceEasyAuth.Utilities;
using Microsoft.AspNetCore.Components.Authorization;
public static class AuthenticationStateExtension
{
public static string ExtractFullName(this AuthenticationState authState)
{
return AuthUtil.ExtractFullName(authState);
}
public static string ExtractEmailAddress(this AuthenticationState authState)
{
return AuthUtil.ExtractEmailAddress(authState);
}
}
NavigationManagerExtention
Extensions/NavigationManagerExtention
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.WebUtilities;
using System;
namespace Hovermind.Blazor.Extensions
{
public enum CrudOperation : sbyte
{
created = 1,
updated = 2,
deleted = 3
}
public static class NavigationManagerExtention
{
public static string ExtractFlagFromQueryString(this NavigationManager nm, CrudOperation operation)
{
var query = new Uri(nm.Uri).Query;
if (QueryHelpers.ParseQuery(query).TryGetValue(operation.ToString(), out var val))
{
return val;
}
return string.Empty;
}
}
}