File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ using Microsoft . AspNetCore . Mvc . ViewFeatures ;
2+ using System ;
3+
4+ namespace GridEditor . RazorPages
5+ {
6+ public static class TempDataHelper
7+ {
8+ public static void SetSuccessMessage ( this ITempDataDictionary tempData , string message )
9+ {
10+ tempData . Remove ( AlertCss . Success ) ;
11+ if ( string . IsNullOrEmpty ( message ) ) return ;
12+ tempData . Add ( AlertCss . Success , message ) ;
13+ }
14+
15+ public static void SetErrorMessage ( this ITempDataDictionary tempData , string message )
16+ {
17+ tempData . Remove ( AlertCss . Error ) ;
18+ tempData . Add ( AlertCss . Error , message ) ;
19+ }
20+
21+ public static void SetErrorMessage ( this ITempDataDictionary tempData , Exception exception )
22+ {
23+ tempData . Remove ( AlertCss . Error ) ;
24+ tempData . Add ( AlertCss . Error , exception . Message ) ;
25+ }
26+
27+ public static void ClearErrorMessage ( this ITempDataDictionary tempData )
28+ {
29+ tempData . Remove ( AlertCss . Error ) ;
30+ }
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments