core flash
1.0.0
ASP.NET MVC核心的簡約閃存消息系統,以基於Bootstrap警報的操作之間提供上下文反饋消息
您應該安裝core.flash:
Install-Package Core.Flash
來自Package Manager控制台的此命令將下載和安裝Core.Flash和所有必需的依賴項。
在您的啟動類中註冊Core.Flash Services
public void ConfigureServices ( IServiceCollection services )
{
services
. AddFlashes ( )
. AddMvc ( ) ;
}一旦您註冊了Core.Flash Services,就可以在控制器中註入Iflasher接口:
public HomeController ( IFlasher f )
{
this . f = f ;
}並調用閃存方法傳遞類型和消息:
public IActionResult YourAction ( )
{
f . Flash ( Types . Success , "Flash message system for ASP.NET MVC Core" , dismissable : true ) ;
f . Flash ( Types . Danger , "Flash message system for ASP.NET MVC Core" , dismissable : false ) ;
return RedirectToAction ( "AnotherAction" ) ;
}將core.flash taghelper添加到您的_viewimports.cs
@using Core . Flash . Web
@addTagHelper * , Microsoft . AspNetCore . Mvc . TagHelpers
@addTagHelper * , Core . Flash將taghelper添加到您的_layout.cs
< div class =" container body-content " >
< div flashes > </ div >
@RenderBody()
< hr />
< footer >
< p > © 2017 </ p >
</ footer >
</ div >core.flash使用引導警報。

_ copyright©2017 lurumad貢獻者