@@ -33,13 +33,13 @@ public static CollectionResult<T> Fail(string title)
3333 var problem = Problem . Create ( title , title , ( int ) HttpStatusCode . InternalServerError ) ;
3434 return Create ( false , default , 0 , 0 , 0 , problem ) ;
3535 }
36-
36+
3737 public static CollectionResult < T > Fail ( string title , string detail )
3838 {
3939 var problem = Problem . Create ( title , detail ) ;
4040 return Create ( false , default , 0 , 0 , 0 , problem ) ;
4141 }
42-
42+
4343 public static CollectionResult < T > Fail ( string title , string detail , HttpStatusCode status )
4444 {
4545 var problem = Problem . Create ( title , detail , ( int ) status ) ;
@@ -50,7 +50,7 @@ public static CollectionResult<T> Fail(Exception exception)
5050 {
5151 return new CollectionResult < T > ( false , default , 0 , 0 , 0 , Problem . Create ( exception , ( int ) HttpStatusCode . InternalServerError ) ) ;
5252 }
53-
53+
5454 public static CollectionResult < T > Fail ( Exception exception , HttpStatusCode status )
5555 {
5656 return new CollectionResult < T > ( false , default , 0 , 0 , 0 , Problem . Create ( exception , ( int ) status ) ) ;
@@ -61,6 +61,26 @@ public static CollectionResult<T> FailValidation(params (string field, string me
6161 return new CollectionResult < T > ( false , default , 0 , 0 , 0 , Problem . Validation ( errors ) ) ;
6262 }
6363
64+ public static CollectionResult < T > FailBadRequest ( )
65+ {
66+ var problem = Problem . Create (
67+ ProblemConstants . Titles . BadRequest ,
68+ ProblemConstants . Messages . BadRequest ,
69+ ( int ) HttpStatusCode . BadRequest ) ;
70+
71+ return Create ( false , default , 0 , 0 , 0 , problem ) ;
72+ }
73+
74+ public static CollectionResult < T > FailBadRequest ( string detail )
75+ {
76+ var problem = Problem . Create (
77+ ProblemConstants . Titles . BadRequest ,
78+ detail ,
79+ ( int ) HttpStatusCode . BadRequest ) ;
80+
81+ return Create ( false , default , 0 , 0 , 0 , problem ) ;
82+ }
83+
6484 public static CollectionResult < T > FailUnauthorized ( )
6585 {
6686 var problem = Problem . Create (
@@ -70,7 +90,7 @@ public static CollectionResult<T> FailUnauthorized()
7090
7191 return Create ( false , default , 0 , 0 , 0 , problem ) ;
7292 }
73-
93+
7494 public static CollectionResult < T > FailUnauthorized ( string detail )
7595 {
7696 var problem = Problem . Create (
@@ -90,7 +110,7 @@ public static CollectionResult<T> FailForbidden()
90110
91111 return Create ( false , default , 0 , 0 , 0 , problem ) ;
92112 }
93-
113+
94114 public static CollectionResult < T > FailForbidden ( string detail )
95115 {
96116 var problem = Problem . Create (
@@ -110,7 +130,7 @@ public static CollectionResult<T> FailNotFound()
110130
111131 return Create ( false , default , 0 , 0 , 0 , problem ) ;
112132 }
113-
133+
114134 public static CollectionResult < T > FailNotFound ( string detail )
115135 {
116136 var problem = Problem . Create (
@@ -125,7 +145,7 @@ public static CollectionResult<T> Fail<TEnum>(TEnum errorCode) where TEnum : Enu
125145 {
126146 return new CollectionResult < T > ( false , default , 0 , 0 , 0 , Problem . Create ( errorCode ) ) ;
127147 }
128-
148+
129149 public static CollectionResult < T > Fail < TEnum > ( TEnum errorCode , string detail ) where TEnum : Enum
130150 {
131151 return new CollectionResult < T > ( false , default , 0 , 0 , 0 , Problem . Create ( errorCode , detail ) ) ;
@@ -135,9 +155,9 @@ public static CollectionResult<T> Fail<TEnum>(TEnum errorCode, HttpStatusCode st
135155 {
136156 return new CollectionResult < T > ( false , default , 0 , 0 , 0 , Problem . Create ( errorCode , errorCode . ToString ( ) , ( int ) status ) ) ;
137157 }
138-
158+
139159 public static CollectionResult < T > Fail < TEnum > ( TEnum errorCode , string detail , HttpStatusCode status ) where TEnum : Enum
140160 {
141161 return new CollectionResult < T > ( false , default , 0 , 0 , 0 , Problem . Create ( errorCode , detail , ( int ) status ) ) ;
142162 }
143- }
163+ }
0 commit comments