コード例 #1
0
        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));
        }
コード例 #2
0
        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());
        }
コード例 #3
0
 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
     })));
 }
コード例 #4
0
 // GET: Playlists
 public ActionResult Index()
 {
     return(View(playlistManager.ReadPlaylists()));
 }