我有以下功能,我希望在我的asp.net网页2应用程序中可用于几个.cshtml视图.如何使该功能可用于应用程序中的任何视图(而不仅仅是一个).
@functions {
public bool DisplayButton(String startDate, String endDate)
{
return Convert.ToDateTime(startDate) < DateTime.Now && Convert.ToDateTime(endDate) > DateTime.Now;
}
}
Run Code Online (Sandbox Code Playgroud)