Exemplo n.º 1
0
 public SearchAlbum()
 {
     InitializeComponent();
     searchBar.TextColor = RadialGradientBrush.DarkGray.Color;
     vm             = new MusicListViewModel();
     BindingContext = vm;
 }
Exemplo n.º 2
0
        public ViewResult List(int page = 1)
        {
            var model = new MusicListViewModel
            {
                musicTracks = _musicRepository.MusicTracks
                              .OrderBy(music => music.MusicTrackId)
                              .Skip((page - 1) * pageSize)
                              .Take(pageSize),
                pagingInfo = new PagingInfo
                {
                    CurrentPage  = page,
                    ItemsPerPage = pageSize,
                    TotalItems   = _musicRepository.MusicTracks.Count()
                }
            };

            return(View(model));



            //return View(_musicRepository.MusicTracks
            //	.OrderBy(musicTrack => musicTrack.MusicTrackId)
            //	.Skip((page - 1) * pageSize)
            //	.Take(pageSize));
        }
 public ActionResult MusicToPlaylist(int MusicID, MusicListViewModel model)
 {
     if (model.Playlist != 0)
     {
         _context.MusicPlaylistCombs.Add(new MusicPlaylistComb()
         {
             MusicID = MusicID, MusicPlaylistID = model.Playlist
         });
         _context.SaveChanges();
     }
     return(RedirectToAction(nameof(Index)));
 }
        public MusicListPage()
        {
            this.InitializeComponent();
            _vm = Ioc.Default.GetRequiredService <MusicListViewModel>();

            WeakReferenceMessenger.Default.Register <MusicListPage, string, string>(this, nameof(MusicFileScanningService), (page, mes) =>
            {
                if (mes == "Started")
                {
                    page.DisableLayer_Border.Visibility = Visibility.Visible;
                }

                if (mes == "Finished")
                {
                    page.DisableLayer_Border.Visibility = Visibility.Collapsed;
                }
            });
        }
        public IActionResult Index()
        {
            var userId = userManager.GetUserId(HttpContext.User);
            var model  = new MusicListViewModel();

            model.Musics = new List <MusicViewModels>();
            var musics        = _context.Musics;
            var UserPlaylists = _context.MusicPlaylists.Include(p => p.Musics).Where(p => p.UserId == userId).ToList();

            foreach (var music in musics)
            {
                var selectlistitems = new List <SelectListItem>();

                foreach (var playlist in UserPlaylists)
                {
                    if (!_context.MusicPlaylistCombs.Any(p => p.MusicID == music.ID && p.MusicPlaylistID == playlist.ID))
                    {
                        selectlistitems.Add(new SelectListItem()
                        {
                            Value = playlist.ID.ToString(), Text = playlist.Naam
                        });
                    }
                }
                model.Musics.Add(new MusicViewModels()
                {
                    ID           = music.ID,
                    Titel        = music.Titel,
                    ReleaseDate  = music.ReleaseDate,
                    Lenght       = music.Lenght,
                    PhotoPath    = music.PhotoPath,
                    WantToListen = music.WantToListen,
                    Listened     = music.Listened,
                    Playlist     = selectlistitems,
                });
            }
            ViewData["playlist"] = new SelectList(_context.MusicPlaylists, "ID", "Naam");
            return(View(model));
        }
Exemplo n.º 6
0
 private void MusicButton_Click(object sender, RoutedEventArgs e)
 {
     DataContext = new MusicListViewModel();
 }