Skip to content

Commit fc96818

Browse files
Merge pull request #61 from DilmurodDeveloper/users/DilmurodDeveloper/exposers-reader-put
EXPOSERS: Put Reader
2 parents d0639c5 + 7d8dad1 commit fc96818

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

LibraryManagement.Api/Controllers/ReadersController.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,38 @@ public async ValueTask<ActionResult<Reader>> GetReaderByIdAsync(Guid readerId)
104104
return InternalServerError(readerServiceException.InnerException);
105105
}
106106
}
107+
108+
[HttpPut]
109+
public async ValueTask<ActionResult<Reader>> PutReaderAsync(Reader reader)
110+
{
111+
try
112+
{
113+
Reader modifyReader =
114+
await this.readerService.ModifyReaderAsync(reader);
115+
116+
return Ok(modifyReader);
117+
}
118+
catch (ReaderValidationException readerValidationException)
119+
when (readerValidationException.InnerException is NotFoundReaderException)
120+
{
121+
return NotFound(readerValidationException.InnerException);
122+
}
123+
catch (ReaderValidationException readerValidationException)
124+
{
125+
return BadRequest(readerValidationException.InnerException);
126+
}
127+
catch (ReaderDependencyValidationException readerDependencyValidationException)
128+
{
129+
return Conflict(readerDependencyValidationException.InnerException);
130+
}
131+
catch (ReaderDependencyException readerDependencyException)
132+
{
133+
return InternalServerError(readerDependencyException.InnerException);
134+
}
135+
catch (ReaderServiceException readerServiceException)
136+
{
137+
return InternalServerError(readerServiceException.InnerException);
138+
}
139+
}
107140
}
108141
}

0 commit comments

Comments
 (0)