Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit d9ec84f

Browse files
committed
Aggiunta metodo statico ResultUnprocessableEntity
1 parent bae43db commit d9ec84f

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/NET6CustomLibrary/Errors/ErrorResult.cs

+28
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,32 @@ public class ErrorResult
77
public int TypeCode { get; set; } = 0;
88
public string InstancePath { get; set; }
99
public List<string> Message { get; set; }
10+
11+
public static ErrorResult ResultUnprocessableEntity(List<string> listErrors, HttpContext httpContext)
12+
{
13+
ErrorResult errorResult = new()
14+
{
15+
TitleCode = "Validation errors",
16+
StatusCode = HttpStatusCode.UnprocessableEntity,
17+
TypeCode = 0,
18+
InstancePath = httpContext.Request.Path,
19+
Message = listErrors
20+
};
21+
22+
return errorResult;
23+
}
24+
25+
//public static ErrorResult ResultNotFound(List<string> listErrors, HttpContext httpContext)
26+
//{
27+
// ErrorResult errorResult = new()
28+
// {
29+
// TitleCode = "Not Found",
30+
// StatusCode = HttpStatusCode.NotFound,
31+
// TypeCode = 0,
32+
// InstancePath = httpContext.Request.Path,
33+
// Message = listErrors
34+
// };
35+
36+
// return errorResult;
37+
//}
1038
}

0 commit comments

Comments
 (0)