File tree Expand file tree Collapse file tree 4 files changed +40
-19
lines changed
Expand file tree Collapse file tree 4 files changed +40
-19
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ //-----------------------------------------------------------
2+ // Copyright (c) Coalition of Good-Hearted Engineers
3+ // Free To Use To Build Reliable Library Management Solutions
4+ //-----------------------------------------------------------
5+
6+ using LibraryManagement . Api . Models . Foundations . ReaderBooks ;
7+ using LibraryManagement . Api . Services . Foundations . ReaderBooks ;
8+ using Microsoft . AspNetCore . Mvc ;
9+ using RESTFulSense . Controllers ;
10+
11+ namespace LibraryManagement . Api . Controllers
12+ {
13+ [ ApiController ]
14+ [ Route ( "api/[controller]" ) ]
15+ public class ReaderBooksController : RESTFulController
16+ {
17+ private readonly IReaderBookService readerBookService ;
18+
19+ public ReaderBooksController ( IReaderBookService readerBookService ) =>
20+ this . readerBookService = readerBookService ;
21+
22+ [ HttpGet ( "{readerId}" ) ]
23+ public async ValueTask < ActionResult < ReaderBook > > GetReaderBookByIdAsync ( Guid readerId )
24+ {
25+ try
26+ {
27+ ReaderBook readerBook =
28+ await this . readerBookService . RetrieveReaderBookByIdAsync ( readerId ) ;
29+
30+ return Ok ( readerBook ) ;
31+ }
32+ catch ( Exception exception )
33+ {
34+ return StatusCode ( 500 , exception . Message ) ;
35+ }
36+ }
37+ }
38+ }
Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ public class Book
1414 public string BookTitle { get ; set ; }
1515 public string Author { get ; set ; }
1616 public string Genre { get ; set ; }
17- [ JsonIgnore ]
1817 public Guid ? ReaderId { get ; set ; }
1918 [ JsonIgnore ]
2019 public Reader ? Reader { get ; set ; }
Original file line number Diff line number Diff line change 66using LibraryManagement . Api . Brokers . Loggings ;
77using LibraryManagement . Api . Brokers . Storages ;
88using LibraryManagement . Api . Services . Foundations . Books ;
9+ using LibraryManagement . Api . Services . Foundations . ReaderBooks ;
910using LibraryManagement . Api . Services . Foundations . Readers ;
1011using Microsoft . OpenApi . Models ;
1112
2223builder . Services . AddTransient < ILoggingBroker , LoggingBroker > ( ) ;
2324builder . Services . AddTransient < IBookService , BookService > ( ) ;
2425builder . Services . AddTransient < IReaderService , ReaderService > ( ) ;
26+ builder . Services . AddTransient < IReaderBookService , ReaderBookService > ( ) ;
2527builder . Services . AddControllers ( ) ;
2628builder . Services . AddEndpointsApiExplorer ( ) ;
2729
You can’t perform that action at this time.
0 commit comments