/// <summary> /// Displays view with home page /// </summary> /// <returns>View with home page</returns> public async Task <IActionResult> Index() { ApplicationUser user = null; /* * If user is not authenticated then get bloag aouthor data from json file, * in other case query data from database */ if (!User.Identity.IsAuthenticated) { user = await _userManagement.FindByEmailAsync(_defaultUserData.Email); } else { user = await _userManagement.FindUserByPrincipal(HttpContext.User); } // create model for home view HomeViewModel model = new HomeViewModel() { RecentPosts = await _databaseProvider.GetMostRecentPosts(5), BlogAuthor = user.FirstName + " " + user.LastName, GithubProfile = user.GithubProfile, LinkedinProfile = user.LinkedinProfile, Email = user.Email, AboutAuthor = _formatContent.NewLineToHTML(user.AboutAuthor), ProfilePhoto = user.ProfilePhoto, TagsCloud = await _databaseProvider.GetUniqueTags() }; return(View(model)); }
public async Task <IActionResult> Details(string slug) { if (slug == String.Empty) { return(NotFound()); } var postDetails = await _databaseProvider.GetPostBySlug(slug); postDetails.Content = _formatContent.FormatXMLBlocks(postDetails.Content, "[xmldata]", "[/xmldata]"); postDetails.Content = _formatContent.NewLineToHTML(postDetails.Content); if (postDetails == null) { return(NotFound()); } return(View(postDetails)); }