public IActionResult Index() { try { string username = User.Claims.FirstOrDefault(y => y.Type == "user_id").Value; var user = userService.FindUserById(username); aiService.TrackUser("Homepage", username); if (user == null || string.IsNullOrEmpty(user.topics)) { ViewBag.user = string.Empty; } else { ViewBag.user = user.Id; } ViewBag.title = "Home"; ViewBag.LastTopics = topicService.GetLastTopics(); ViewBag.TrendingTopics = topicService.GetTrendingTopics(); } catch (Exception ex) { aiService.TrackException(ex); } return(View()); }
public IActionResult WordCloud() { try { var topicsList = topicService.GetTopics(200); return(Json(topicsList)); } catch (Exception ex) { aiService.TrackException(ex); } return(null); }
public IActionResult GenerateMyList(string title, string tags, int pageIndex = 0, int pageSize = 15, bool star = false) { try { string username = User.Claims.FirstOrDefault(y => y.Type == "user_id").Value; aiService.TrackUser("GenerateMyList", username); var tuple = userArticleService.GetUserUnviewedArticles(username, title, tags, pageIndex, pageSize, star); return(Json(new { data = tuple.Item1, itemsCount = tuple.Item2 })); } catch (Exception ex) { aiService.TrackException(ex); return(Json(new { data = new List <UserArticles>(), itemsCount = 0 })); } }