Exemplo n.º 1
0
        public ActionResult UserPlaylist(Guid friendId)
        {
            if (Session[SessionKey.UserId] == null)
            {
                return(RedirectToAction("Login", "Account"));
            }

            var friend = UserDAO.GetUser(friendId);

            if (friend == null)
            {
                return(RedirectToAction("Index"));
            }
            var user = UserDAO.GetUser((Guid)Session[SessionKey.UserId]);

            if (user.Friends.Contains(friend) && friend.Friends.Contains(user))
            {
                var vm = PlaylistIndexVM.ToVM(friend.Playlists);
                return(View(vm));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
Exemplo n.º 2
0
        // GET: Playlist
        public ActionResult Index()
        {
            if (Session[SessionKey.UserId] == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            var user = UserDAO.GetUser((Guid)Session[SessionKey.UserId]);
            var vm   = PlaylistIndexVM.ToVM(user.Playlists);

            return(View(vm));
        }
Exemplo n.º 3
0
        public ActionResult Ajax_ListPlaylist()
        {
            if (Session[SessionKey.UserId] == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.Forbidden));
            }
            var user = UserDAO.GetUser((Guid)Session[SessionKey.UserId]);
            var vm   = PlaylistIndexVM.ToVM(user.Playlists);

            return(Json(new { playlists = vm.Playlists }));
        }