22 lines
574 B
C#
22 lines
574 B
C#
using Microsoft.AspNetCore.Mvc.Rendering;
|
|
|
|
namespace Library;
|
|
|
|
public static class HtmlExtensions
|
|
{
|
|
public static string IsNull( this IHtmlHelper htmlHelper , object? attempt , string fallback )
|
|
{
|
|
return htmlHelper.Encode( attempt?.ToString( ) ?? fallback );
|
|
}
|
|
|
|
public static string IF( this IHtmlHelper htmlHelper , bool test , string value )
|
|
{
|
|
return htmlHelper.Encode( test ? value : "" );
|
|
}
|
|
|
|
public static string IIF( this IHtmlHelper htmlHelper , bool test , string value_1 , string value_2 )
|
|
{
|
|
return htmlHelper.Encode( test ? value_1 : value_2 );
|
|
}
|
|
};
|