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")); } }
// 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)); }
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 })); }