/// <summary> /// Initializes a new instance of the <see cref="SourcesModule" /> class. /// </summary> public SourcesModule( ISourcesRepository repository, IUriTemplateExpander expander, IIriTemplateFactory templateFactory, IModelTemplateProvider modelTemplateProvider, ISupportedClassMetaProvider supportedClass) : base(modelTemplateProvider) { this.expander = expander; this.expander = expander; this.templateFactory = templateFactory; this.supportedClass = supportedClass; this.Get <Brochure>(async r => await this.GetSingle(repository.GetBrochure)); this.Get <Book>(async r => await this.GetSingle(repository.GetBook)); this.Get <Magazine>(async r => await this.GetSingle(repository.GetMagazine)); this.Get <Collection <Issue> >(async r => await this.GetSingle(repository.GetMagazineIssues, new Collection <Issue>())); this.Get <Issue>(async r => await this.GetSingle(repository.GetIssue)); using (this.Templates) { this.Get <Collection <Brochure> >(async r => await this.GetPage <Brochure, BrochureFilters>((int?)r.page, repository.GetBrochures)); this.Get <Collection <Magazine> >(async r => await this.GetPage <Magazine, MagazineFilters>((int?)r.page, repository.GetMagazines)); this.Get <Collection <Book> >(async r => await this.GetPage <Book, BookFilters>((int?)r.page, repository.GetBooks)); } }
public WishlistModule( IModelTemplateProvider provider, IIriTemplateFactory templateFactory, IWishlistRepository wishlistRepository, IWishlistPersistence wishlistPersistence) : base(provider) { this.templateFactory = templateFactory; this.wishlistRepository = wishlistRepository; this.wishlistPersistence = wishlistPersistence; using (this.Templates) { this.Put <WishlistItem>(this.PutWishlistItem); this.Get <Collection <WishlistItem> >(this.GetWishlist); } }
public IssuesModule(IIriTemplateFactory templateFactory, IModelTemplateProvider provider) : base(provider) { this.templateFactory = templateFactory; using (Templates) { Get <Issue>(_ => new Issue { Id = Request.Url, Content = "This Hydra library is not yet complete", DateCreated = new DateTime(2016, 3, 21), IsResolved = _.id % 2 == 0, ProjectId = (IriRef)"/project/argolis", Submitter = new User { Name = "Tomasz", LastName = "Pluskiewicz" }, Title = "Complete implementation" }); Get <Collection <Issue> >(_ => StubCollection(this.Bind <IssueFilter>())); } }