public SearchController(
     IHostingEnvironment hostingEnvironment,
     IOptionsMonitor <BlogPostsSettings> blogPostsConfig, IMemoryCache cache, ILogger <SearchController> logger) : base(hostingEnvironment)
 {
     _blogPostsConfig = blogPostsConfig.CurrentValue;
     _cache           = cache;
     _logger          = logger;
 }
Example #2
0
 public HomeController(
     IHostingEnvironment hostingEnvironment,
     IOptionsMonitor <BlogPostsSettings> blogPostsConfig,
     IOptionsMonitor <SiteSettings> siteSettings) : base(hostingEnvironment)
 {
     _blogPostsConfig = blogPostsConfig.CurrentValue;
     _siteSettings    = siteSettings.CurrentValue;
 }
 public ContactController(
     IHostingEnvironment hostingEnvironment,
     IOptionsMonitor <BlogPostsSettings> blogPostsConfig,
     IOptions <EmailSettings> emailSettings,
     IOptions <GoogleRecaptchaSettings> googleRecaptchaSettings,
     IGoogleRecaptcha googleRecaptcha,
     IEmailSender emailSender) : base(hostingEnvironment)
 {
     _hostingEnvironment      = hostingEnvironment;
     _blogPostsConfig         = blogPostsConfig.CurrentValue;
     _emailSettings           = emailSettings.Value;
     _emailSender             = emailSender;
     _googleRecaptchaSettings = googleRecaptchaSettings.Value;
     _googleRecaptcha         = googleRecaptcha;
 }
Example #4
0
        private FeedResult(SiteSettings siteSettings, BlogPostsSettings blogPostsConfig, string feedType = "Rss")
        {
            _siteSettings    = siteSettings;
            _blogPostsConfig = blogPostsConfig;

            var sw = new StringWriter();

            using (XmlWriter xmlWriter = XmlWriter.Create(sw, new XmlWriterSettings()
            {
                Async = true, Indent = true, Encoding = Encoding.UTF8
            }))
            {
                XmlFeedWriter writer = "Atom".Equals(feedType) ? InitializeAtomFeedWriter(xmlWriter) : InitializeRssFeedWriter(xmlWriter);
                foreach (var post in GetFeed())
                {
                    writer.Write(post);
                }
                xmlWriter.Flush();
            }
            Content     = sw.ToString().Replace("utf-16", "utf-8");
            ContentType = "application/rss+xml; charset=utf-8";
        }
Example #5
0
 public TagController(
     IHostingEnvironment hostingEnvironment,
     IOptionsMonitor <BlogPostsSettings> blogPostsConfig) : base(hostingEnvironment)
 {
     _blogPostsConfig = blogPostsConfig.CurrentValue;
 }
Example #6
0
 /// <summary>
 /// Returns Atom Feed Result
 /// </summary>
 /// <param name="siteSettings"></param>
 /// <param name="blogPostsConfig"></param>
 /// <returns></returns>
 public static FeedResult Atom(SiteSettings siteSettings, BlogPostsSettings blogPostsConfig)
 {
     return(new FeedResult(siteSettings, blogPostsConfig, "Atom"));
 }