8
8
9
9
namespace JsonApiDotNetCore . Controllers
10
10
{
11
- public class BaseJsonApiController < T >
11
+ public class BaseJsonApiController < T >
12
12
: BaseJsonApiController < T , int >
13
13
where T : class , IIdentifiable < int >
14
14
{
@@ -47,7 +47,7 @@ public class BaseJsonApiController<T, TId>
47
47
private readonly ICreateService < T , TId > _create ;
48
48
private readonly IUpdateService < T , TId > _update ;
49
49
private readonly IUpdateRelationshipService < T , TId > _updateRelationships ;
50
- private readonly IDeleteService < T , TId > _delete ;
50
+ private readonly IDeleteService < T , TId > _delete ;
51
51
private readonly IJsonApiContext _jsonApiContext ;
52
52
53
53
public BaseJsonApiController (
@@ -156,7 +156,7 @@ public virtual async Task<IActionResult> PostAsync([FromBody] T entity)
156
156
return Forbidden ( ) ;
157
157
158
158
if ( _jsonApiContext . Options . ValidateModelState && ! ModelState . IsValid )
159
- return BadRequest ( ModelState . ConvertToErrorCollection ( ) ) ;
159
+ return BadRequest ( ModelState . ConvertToErrorCollection ( _jsonApiContext . ContextGraph ) ) ;
160
160
161
161
entity = await _create . CreateAsync ( entity ) ;
162
162
@@ -170,7 +170,7 @@ public virtual async Task<IActionResult> PatchAsync(TId id, [FromBody] T entity)
170
170
if ( entity == null )
171
171
return UnprocessableEntity ( ) ;
172
172
if ( _jsonApiContext . Options . ValidateModelState && ! ModelState . IsValid )
173
- return BadRequest ( ModelState . ConvertToErrorCollection ( ) ) ;
173
+ return BadRequest ( ModelState . ConvertToErrorCollection ( _jsonApiContext . ContextGraph ) ) ;
174
174
175
175
var updatedEntity = await _update . UpdateAsync ( id , entity ) ;
176
176
0 commit comments