File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
LibraryManagement.Api/Controllers Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -102,5 +102,38 @@ public async ValueTask<ActionResult<Book>> GetBookByIdAsync(Guid bookId)
102102 return InternalServerError ( bookServiceException . InnerException ) ;
103103 }
104104 }
105+
106+ [ HttpPut ]
107+ public async ValueTask < ActionResult < Book > > PutBookAsync ( Book book )
108+ {
109+ try
110+ {
111+ Book modifyBook =
112+ await this . bookService . ModifyBookAsync ( book ) ;
113+
114+ return Ok ( modifyBook ) ;
115+ }
116+ catch ( BookValidationException bookValidationException )
117+ when ( bookValidationException . InnerException is NotFoundBookException )
118+ {
119+ return NotFound ( bookValidationException . InnerException ) ;
120+ }
121+ catch ( BookValidationException bookValidationException )
122+ {
123+ return BadRequest ( bookValidationException . InnerException ) ;
124+ }
125+ catch ( BookDependencyValidationException bookDependencyValidationException )
126+ {
127+ return Conflict ( bookDependencyValidationException . InnerException ) ;
128+ }
129+ catch ( BookDependencyException bookDependencyException )
130+ {
131+ return InternalServerError ( bookDependencyException . InnerException ) ;
132+ }
133+ catch ( BookServiceException bookServiceException )
134+ {
135+ return InternalServerError ( bookServiceException . InnerException ) ;
136+ }
137+ }
105138 }
106139}
You can’t perform that action at this time.
0 commit comments