File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
LibraryManagement.Api/Controllers Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -137,5 +137,43 @@ public async ValueTask<ActionResult<Reader>> PutReaderAsync(Reader reader)
137137 return InternalServerError ( readerServiceException . InnerException ) ;
138138 }
139139 }
140+
141+ [ HttpDelete ]
142+ public async ValueTask < ActionResult < Reader > > DeleteReaderAsync ( Guid readerId )
143+ {
144+ try
145+ {
146+ Reader deleteReader =
147+ await this . readerService . RemoveReaderByIdAsync ( readerId ) ;
148+
149+ return Ok ( deleteReader ) ;
150+ }
151+ catch ( ReaderValidationException readerValidationException )
152+ when ( readerValidationException . InnerException is NotFoundReaderException )
153+ {
154+ return NotFound ( readerValidationException . InnerException ) ;
155+ }
156+ catch ( ReaderValidationException readerValidationException )
157+ {
158+ return BadRequest ( readerValidationException . InnerException ) ;
159+ }
160+ catch ( ReaderDependencyValidationException readerDependencyValidationException )
161+ when ( readerDependencyValidationException . InnerException is LockedReaderException )
162+ {
163+ return Locked ( readerDependencyValidationException . InnerException ) ;
164+ }
165+ catch ( ReaderDependencyValidationException readerDependencyValidationException )
166+ {
167+ return BadRequest ( readerDependencyValidationException . InnerException ) ;
168+ }
169+ catch ( ReaderDependencyException readerDependencyException )
170+ {
171+ return InternalServerError ( readerDependencyException . InnerException ) ;
172+ }
173+ catch ( ReaderServiceException readerServiceException )
174+ {
175+ return InternalServerError ( readerServiceException . InnerException ) ;
176+ }
177+ }
140178 }
141179}
You can’t perform that action at this time.
0 commit comments