Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lurumad/core-flash
Minimalist flash message system for ASP.NET MVC Core.
https://github.com/lurumad/core-flash
alerts asp-net-core bootstrap flash mvc
Last synced: 9 days ago
JSON representation
Minimalist flash message system for ASP.NET MVC Core.
- Host: GitHub
- URL: https://github.com/lurumad/core-flash
- Owner: lurumad
- License: apache-2.0
- Created: 2017-05-29T15:39:55.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-01T11:38:27.000Z (almost 2 years ago)
- Last Synced: 2024-11-03T09:08:43.659Z (15 days ago)
- Topics: alerts, asp-net-core, bootstrap, flash, mvc
- Language: C#
- Homepage:
- Size: 1.75 MB
- Stars: 24
- Watchers: 1
- Forks: 8
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Core.Flash [![NuGet](https://img.shields.io/nuget/v/Core.Flash.svg)](https://www.nuget.org/packages/Core.Flash/)
Minimalistic flash message system for ASP.NET MVC Core to provide contextual feedback messages between actions based on [Bootstrap Alerts](https://getbootstrap.com/docs/4.0/components/alerts/)
### Install Core.Flash
You should install [Core.Flash](https://www.nuget.org/packages/Core.Flash/):
Install-Package Core.Flash
This command from Package Manager Console will download and install Core.Flash and all required dependencies.### Meet Core.Flash
Register **Core.Flash** services in your **Startup** class
```csharp
public void ConfigureServices(IServiceCollection services)
{
services
.AddFlashes()
.AddMvc();
}
```
Once you have been register **Core.Flash** services, you can inject the **IFlasher** interface in your Controllers:```csharp
public HomeController(IFlasher f)
{
this.f = f;
}
```
And call **Flash** method passing a type and the message:```csharp
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");
}
```
Add **Core.Flash TagHelper** to your **_ViewImports.cs**```csharp
@using Core.Flash.Web
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, Core.Flash
```
Add the TagHelper to your **_Layout.cs**```html
@RenderBody()
© 2017
```**Core.Flash** uses [Bootstrap Alerts](https://v4-alpha.getbootstrap.com/components/alerts/).
![Sample](https://github.com/lurumad/core-flash/blob/master/assets/flash.gif)
_Copyright © 2017 Lurumad Contributors