initial commit
This commit is contained in:
21
App_Code/HtmlExtensions.cs
Normal file
21
App_Code/HtmlExtensions.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
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 );
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user