44
55namespace FINT . Model . Resource
66{
7- public abstract class AbstractCollectionResources < T >
7+ public abstract class AbstractCollectionResources < T >
8+ {
9+ [ JsonProperty ( PropertyName = "_links" ) ]
10+ protected readonly Dictionary < string , List < Link > > Links = new Dictionary < string , List < Link > > ( ) ;
11+
12+ [ JsonProperty ( PropertyName = "_embedded" ) ]
13+ protected EmbeddedResources < T > Embedded = new EmbeddedResources < T > ( ) ;
14+
15+ [ JsonProperty ( PropertyName = "total_items" ) ]
16+ public int TotalItems
17+ {
18+ get
19+ {
20+ return Embedded . Entries . Count ;
21+ }
22+ }
23+
24+ public void AddResource ( T resource )
25+ {
26+ Embedded . Entries . Add ( resource ) ;
27+ }
28+
29+ public List < Link > GetSelfLinks ( )
830 {
9- [ JsonProperty ( PropertyName = "_links" ) ]
10- protected readonly Dictionary < string , List < Link > > Links = new Dictionary < string , List < Link > > ( ) ;
11-
12- [ JsonProperty ( PropertyName = "_embedded" ) ]
13- protected EmbeddedResources < T > Embedded = new EmbeddedResources < T > ( ) ;
14-
15- [ JsonProperty ( PropertyName = "total_items" ) ]
16- public int TotalItems { get ; set ; }
17-
18-
19- [ OnSerialized ]
20- internal void OnSerializedMethod ( StreamingContext context )
21- {
22- TotalItems = Embedded . Entries . Count ;
23- }
24-
25- public void AddResource ( T resource )
26- {
27- Embedded . Entries . Add ( resource ) ;
28- }
29-
30- public List < Link > GetSelfLinks ( )
31- {
32- return Links [ "self" ] ;
33- }
34-
35- public List < T > GetContent ( )
36- {
37- return Embedded . Entries ;
38- }
39-
40- public class EmbeddedResources < T >
41- {
42- public EmbeddedResources ( )
43- {
44- Entries = new List < T > ( ) ;
45- }
46-
47- [ JsonProperty ( PropertyName = "_entries" ) ]
48- public List < T > Entries { get ; set ; }
49- }
31+ return Links [ "self" ] ;
32+ }
33+
34+ public List < T > GetContent ( )
35+ {
36+ return Embedded . Entries ;
37+ }
38+
39+ public class EmbeddedResources < T >
40+ {
41+ public EmbeddedResources ( )
42+ {
43+ Entries = new List < T > ( ) ;
44+ }
45+
46+ [ JsonProperty ( PropertyName = "_entries" ) ]
47+ public List < T > Entries { get ; set ; }
5048 }
49+ }
5150}
0 commit comments