public void UpdateBlogPostsJsonFile()
        {
            // Initialize a new service
            var service = new BlogPostsService();

            // Determine the path to the JSON file
            var jsonPath = HostingEnvironment.MapPath("~/App_Data/TEMP/CommunityBlogPosts.json");

            // Generate the raw JSON
            var rawJson = JsonConvert.SerializeObject(service.GetBlogPosts(), Formatting.Indented);

            // Save the JSON to disk
            System.IO.File.WriteAllText(jsonPath, rawJson, Encoding.UTF8);
        }
Example #2
0
        public async Task <ActionResult> CommunityHubUProfileBlogPosts(RenderModel model)
        {
            var vm = new CommunityBlogPostViewModel(model.Content);

            var service = new BlogPostsService();

            var result = await service.GetUprofileBlogPosts();

            if (result != null && result.Any())
            {
                vm.Posts = result;
            }

            return(CurrentTemplate(vm));
        }
 public BlogController()
 {
     _blogPostService = new BlogPostsService();
 }
Example #4
0
 public BlogController([FromServices] BlogPostsService blogPostsService)
 {
     _blogPostsService = blogPostsService;
 }
Example #5
0
 public BlogPostsController(BlogPostsService blogPostsService)
 {
     this._blogPostsService = blogPostsService;
 }