@@ -104,7 +104,7 @@ public BaseJsonApiController(
104104
105105 public virtual async Task < IActionResult > GetAsync ( )
106106 {
107- if ( _getAll == null ) throw new JsonApiException ( 405 , "Get requests are not supported" ) ;
107+ if ( _getAll == null ) throw Exceptions . UnSupportedRequestMethod ;
108108
109109 var entities = await _getAll . GetAsync ( ) ;
110110
@@ -113,7 +113,7 @@ public virtual async Task<IActionResult> GetAsync()
113113
114114 public virtual async Task < IActionResult > GetAsync ( TId id )
115115 {
116- if ( _getById == null ) throw new JsonApiException ( 405 , "Get by Id requests are not supported" ) ;
116+ if ( _getById == null ) throw Exceptions . UnSupportedRequestMethod ;
117117
118118 var entity = await _getById . GetAsync ( id ) ;
119119
@@ -125,7 +125,7 @@ public virtual async Task<IActionResult> GetAsync(TId id)
125125
126126 public virtual async Task < IActionResult > GetRelationshipsAsync ( TId id , string relationshipName )
127127 {
128- if ( _getRelationships == null ) throw new JsonApiException ( 405 , "Get Relationships requests are not supported" ) ;
128+ if ( _getRelationships == null ) throw Exceptions . UnSupportedRequestMethod ;
129129
130130 var relationship = await _getRelationships . GetRelationshipsAsync ( id , relationshipName ) ;
131131 if ( relationship == null )
@@ -136,7 +136,7 @@ public virtual async Task<IActionResult> GetRelationshipsAsync(TId id, string re
136136
137137 public virtual async Task < IActionResult > GetRelationshipAsync ( TId id , string relationshipName )
138138 {
139- if ( _getRelationship == null ) throw new JsonApiException ( 405 , "Get Relationship requests are not supported" ) ;
139+ if ( _getRelationship == null ) throw Exceptions . UnSupportedRequestMethod ;
140140
141141 var relationship = await _getRelationship . GetRelationshipAsync ( id , relationshipName ) ;
142142
@@ -145,7 +145,7 @@ public virtual async Task<IActionResult> GetRelationshipAsync(TId id, string rel
145145
146146 public virtual async Task < IActionResult > PostAsync ( [ FromBody ] T entity )
147147 {
148- if ( _create == null ) throw new JsonApiException ( 405 , "Post requests are not supported" ) ;
148+ if ( _create == null ) throw Exceptions . UnSupportedRequestMethod ;
149149
150150 if ( entity == null )
151151 return UnprocessableEntity ( ) ;
@@ -160,7 +160,7 @@ public virtual async Task<IActionResult> PostAsync([FromBody] T entity)
160160
161161 public virtual async Task < IActionResult > PatchAsync ( TId id , [ FromBody ] T entity )
162162 {
163- if ( _update == null ) throw new JsonApiException ( 405 , "Patch requests are not supported" ) ;
163+ if ( _update == null ) throw Exceptions . UnSupportedRequestMethod ;
164164
165165 if ( entity == null )
166166 return UnprocessableEntity ( ) ;
@@ -175,7 +175,7 @@ public virtual async Task<IActionResult> PatchAsync(TId id, [FromBody] T entity)
175175
176176 public virtual async Task < IActionResult > PatchRelationshipsAsync ( TId id , string relationshipName , [ FromBody ] List < DocumentData > relationships )
177177 {
178- if ( _updateRelationships == null ) throw new JsonApiException ( 405 , "Relationship Patch requests are not supported" ) ;
178+ if ( _updateRelationships == null ) throw Exceptions . UnSupportedRequestMethod ;
179179
180180 await _updateRelationships . UpdateRelationshipsAsync ( id , relationshipName , relationships ) ;
181181
@@ -184,7 +184,7 @@ public virtual async Task<IActionResult> PatchRelationshipsAsync(TId id, string
184184
185185 public virtual async Task < IActionResult > DeleteAsync ( TId id )
186186 {
187- if ( _delete == null ) throw new JsonApiException ( 405 , "Delete requests are not supported" ) ;
187+ if ( _delete == null ) throw Exceptions . UnSupportedRequestMethod ;
188188
189189 var wasDeleted = await _delete . DeleteAsync ( id ) ;
190190
0 commit comments