public IActionResult List()
        {
            var model = new ArtistListViewModel();

            try
            {
                model.Artists = _DataAccessLayer?.ArtistRepository?.GetNewArtists(1);
                var nInt = model?.Artists?.Count;
                model.RecordsFound = nInt ?? 0;
                if (model.RecordsFound > 0)
                {
                    model.Message = string.Format("{0} Records found", model.RecordsFound);
                }
                else
                {
                    model.Message = ArtistAdminStrings.NoDataFound;
                }
            }
            catch (DbException dbE)
            {
                model.Message = dbE.Message;
                return(View("Error", model));
            }
            return(View("List", model));
        }
Exemple #2
0
        void InitViewInjection()
        {
            ViewInjectionManager.Default.Inject(Regions.Content,
                                                NavigationKey.Tracks,
                                                () => TrackListViewModel.Create(),
                                                typeof(TrackListView));
            ViewInjectionManager.Default.Inject(Regions.Navigation,
                                                NavigationKey.Tracks,
                                                () => NavigationItemViewModel.Create("Tracks", NavigationKey.Tracks),
                                                typeof(NavigationItemView));

            ViewInjectionManager.Default.Inject(Regions.Content,
                                                NavigationKey.Artists,
                                                () => ArtistListViewModel.Create(),
                                                typeof(ArtistListView));

            ViewInjectionManager.Default.Inject(Regions.Navigation,
                                                NavigationKey.Artists,
                                                () => NavigationItemViewModel.Create("Artists", NavigationKey.Artists),
                                                typeof(NavigationItemView));

            ViewInjectionManager.Default.Inject(Regions.Content,
                                                NavigationKey.Albums,
                                                () => AlbumTreeViewModel.Create(),
                                                typeof(AlbumTreeView));

            ViewInjectionManager.Default.Inject(Regions.Navigation,
                                                NavigationKey.Albums,
                                                () => NavigationItemViewModel.Create("AlbumTree", NavigationKey.Albums),
                                                typeof(NavigationItemView));

            ViewInjectionManager.Default.Navigate(Regions.Navigation, NavigationKey.Tracks);
        }
Exemple #3
0
        public void IsEditEnabled_SelectedArtistNotNull_EqualsTrue()
        {
            var model = new ArtistListViewModel(null, null)
            {
                SelectedArtist = TestData.GetArtistSample().First()
            };

            Assert.True(model.IsEditEnabled);
        }
Exemple #4
0
        public void IsSearchEnabled_ViewListIsNull_EqualsFalse()
        {
            var model = new ArtistListViewModel(null, null)
            {
                ViewList = null
            };

            Assert.False(model.IsSearchEnabled);
        }
Exemple #5
0
        public void IsEditEnabled_SelectedArtistChanged_EqualsTrue()
        {
            var model = new ArtistListViewModel(null, null);

            Assert.False(model.IsEditEnabled);

            model.SelectedArtist = TestData.GetArtistSample().First();

            Assert.True(model.IsEditEnabled);
        }
Exemple #6
0
        public void IsSearchEnabled_ViewListNotNull_EqualsTrue()
        {
            var model = new ArtistListViewModel(null, null)
            {
                ViewList = new List <Artist>()
            };

            model.CanSearchCheck();

            Assert.True(model.IsSearchEnabled);
        }
        private void GoToSearchedDisco(object sender, RoutedEventArgs e)
        {
            MainView.Items.Clear();
            var userControl = new ListDiscoView();

            DataContext = new ArtistListViewModel(TypeListEnum.Searched, searchTxt.Text);
            userControl.ArtistSelected += new EventHandler(GoToArtistDetails);
            MainView.Items.Add(new TabItem {
                Content = userControl
            });
            MainView.Items.Refresh();
        }
Exemple #8
0
        public void IsEditEnabled_SelectedArtistIsNull_EqualsFalse()
        {
            var model = new ArtistListViewModel(null, null);

            Assert.False(model.IsEditEnabled);
        }
 public ArtistListView(ArtistListViewModel viewModel)
 {
     InitializeComponent();
     this.DataContext = viewModel;
 }