Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions LibraryManagement.Api/Controllers/ReadersController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,38 @@ public async ValueTask<ActionResult<Reader>> GetReaderByIdAsync(Guid readerId)
return InternalServerError(readerServiceException.InnerException);
}
}

[HttpPut]
public async ValueTask<ActionResult<Reader>> PutReaderAsync(Reader reader)
{
try
{
Reader modifyReader =
await this.readerService.ModifyReaderAsync(reader);

return Ok(modifyReader);
}
catch (ReaderValidationException readerValidationException)
when (readerValidationException.InnerException is NotFoundReaderException)
{
return NotFound(readerValidationException.InnerException);
}
catch (ReaderValidationException readerValidationException)
{
return BadRequest(readerValidationException.InnerException);
}
catch (ReaderDependencyValidationException readerDependencyValidationException)
{
return Conflict(readerDependencyValidationException.InnerException);
}
catch (ReaderDependencyException readerDependencyException)
{
return InternalServerError(readerDependencyException.InnerException);
}
catch (ReaderServiceException readerServiceException)
{
return InternalServerError(readerServiceException.InnerException);
}
}
}
}
Loading