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); }
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(); }
public BlogController([FromServices] BlogPostsService blogPostsService) { _blogPostsService = blogPostsService; }
public BlogPostsController(BlogPostsService blogPostsService) { this._blogPostsService = blogPostsService; }