示例#1
0
        // GET: Playlists
        public ActionResult Index()
        {
            if (userService.User == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            var model = new PlayListsViewModel()
            {
                Playlists = playlistRepo.GetByUser(userService.User.Id)
            };

            return(View(model));
        }
示例#2
0
        public ActionResult Index()
        {
            var model = new HomeViewModel();
            var user  = _usersService.User;

            if (user != null)
            {
                model.Playlists = playlistRepo.GetByUser(user.Id).Select(p => new SelectListItem()
                {
                    Text = p.PlaylistName, Value = p.PlaylistId.ToString()
                }).ToList();
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
            return(View(model));
        }