Esempio n. 1
0
        /// <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));
            }
        }
Esempio n. 2
0
 public EntityFactory(
     IUriTemplateExpander expander,
     IWikibusConfiguration configuration,
     [AllowNull] ClaimsPrincipal principal,
     ISourceContext context)
 {
     this.expander      = expander;
     this.configuration = configuration;
     this.principal     = principal;
     this.context       = context;
 }
        public SourcesUpdateModule(
            ISourcesPersistence persistence,
            ISourcesRepository repository,
            IModelTemplateProvider modelTemplateProvider,
            IUriTemplateExpander expander,
            IPdfService pdfService)
            : base(modelTemplateProvider)
        {
            this.RequiresAnyPermissions(Permissions.WriteSources, Permissions.AdminSources);

            this.expander   = expander;
            this.pdfService = pdfService;
            this.Put <Brochure>(async r =>
                                await this.PutSingle(brochure => persistence.SaveBrochure(brochure), repository.GetBrochure));
            this.Post <SourceContent>(
                async r => await this.UploadPdf((int)r.id, repository.GetBrochure, brochure => persistence.SaveBrochure(brochure, true)));
            this.Delete <SourceContent>(
                async r => await this.DeletePdf((int)r.id, repository.GetBrochure, brochure => persistence.SaveBrochure(brochure, true)));
            using (this.Templates)
            {
                this.Post <Collection <Brochure> >(async r =>
                                                   await this.CreateBrochure(persistence.CreateBrochure, repository.GetBrochure));
            }
        }
Esempio n. 4
0
 public SourcesPersistence(ISourceContext context, IUriTemplateMatcher matcher, IUriTemplateExpander expander)
 {
     this.context  = context;
     this.matcher  = matcher;
     this.expander = expander;
 }
Esempio n. 5
0
 public EntityFactory(IUriTemplateExpander expander, IWikibusConfiguration configuration)
 {
     this.expander      = expander;
     this.configuration = configuration;
 }
 public WishlistRepository(ISourceContext context, IUriTemplateExpander expander)
 {
     this.context  = context;
     this.expander = expander;
 }