public IHttpActionResult GetUserPlaylists() { var currentUser = (User.Identity as ClaimsIdentity)?.Claims.First(c => c.Type == "sub").Value; var user = userManager.ReadUser(currentUser); if (user == null) { return(NotFound()); } var playlists = playlistManager.ReadPlaylists(user.Id) .Select(p => new { p.Id, p.Name, p.Key, p.MaximumVotesPerUser, p.Active, p.ImageUrl, p.CreatedById, p.Description }); return(Ok(playlists)); }
public ActionResult Portal() { var user = userManager.ReadUser(HttpContext.User.Identity.Name); if (user == null) { return(RedirectToAction("Index", "Home")); } ViewBag.Name = user.FirstName; ViewBag.MyOrganisations = organisationManager.ReadOrganisationsForUser(user.Id).ToList(); ViewBag.MyPlaylists = playlistManager.ReadPlaylistsForUser(user.Id).ToList(); ViewBag.RecommendedPlaylists = playlistManager.ReadPlaylists().Reverse().Take(3).ToList(); return(View()); }
public IHttpActionResult GetRecommendations(int count) { return(Ok(playlistManager.ReadPlaylists() .Reverse() .Take(count) .Select(p => new { p.Id, p.Name, p.Key, p.MaximumVotesPerUser, p.Active, p.ImageUrl, p.CreatedById, p.Description }))); }
// GET: Playlists public ActionResult Index() { return(View(playlistManager.ReadPlaylists())); }