Commit a8970bb 1 parent 49ca637 commit a8970bb Copy full SHA for a8970bb
File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -16,12 +16,20 @@ public class DanomController
16
16
/// <param name="option"></param>
17
17
/// <param name="viewName"></param>
18
18
/// <param name="noneAction"></param>
19
+ /// <param name="errors"></param>
19
20
/// <returns></returns>
20
21
public IActionResult ViewOption < T > (
21
22
Option < T > option ,
22
23
string ? viewName = null ,
23
- Func < IActionResult > ? noneAction = null ) =>
24
- option . Match (
24
+ Func < IActionResult > ? noneAction = null ,
25
+ ResultErrors ? errors = null )
26
+ {
27
+ if ( errors is not null )
28
+ {
29
+ ModelState . AddResultErrors ( errors ) ;
30
+ }
31
+
32
+ return option . Match (
25
33
some : x =>
26
34
{
27
35
if ( viewName is not null )
@@ -42,6 +50,7 @@ public IActionResult ViewOption<T>(
42
50
43
51
return NotFound ( ) ;
44
52
} ) ;
53
+ }
45
54
46
55
/// <summary>
47
56
/// Renders the specified view with the specified model, and add the
You can’t perform that action at this time.
0 commit comments