Exemple #1
0
        public ActionResult GenreMenu()
        {
            AlbumViewModels model = new AlbumViewModels();

            model.Genres = repo.Genres.GetAll();
            return(PartialView(model));
        }
 public ActionResult UpdateAlbum(int?id)
 {
     _facade = new DataAccessLayerfacade();
     _model  = new AlbumViewModels();
     _model.GetSelectedAlbum = _facade.GetAlbumRep().GetAlbumById(id);
     return(View(_model));
 }
Exemple #3
0
        public ActionResult Index()
        {
            AlbumViewModels model = new AlbumViewModels();

            model.Albums = repo.Albums.GetAll();
            model.Genres = repo.Genres.GetAll();
            return(View(model));
        }
        public ActionResult CreateAlbum()
        {
            _facade = new DataAccessLayerfacade();
            var model = new AlbumViewModels();

            model.AllArtists = _facade.GetArtistRep().GetAllArtist();
            model.AllGenres  = _facade.GetGenreRep().GetAllGenres();
            return(View(model));
        }
Exemple #5
0
        //
        // GET: /Store/Browse
        public ActionResult Browse(int id)
        {
            //Retrieve Genre and its Associated Albums
            var viewModel = new AlbumViewModels()
            {
                Albums    = repo.Albums.GetAlbumsByGenre(id),
                GenreName = repo.Albums.GetGenreById(id).Name
            };

            return(View(viewModel));
        }
        public ActionResult Index(int?id)
        {
            _facade = new DataAccessLayerfacade();
            _model  = new AlbumViewModels();

            if (_facade.GetAlbumRep().GetAllAlbums().Count == 0)
            {
                _model.AllAlbums = _facade.GetAlbumRep().GetAllAlbums();
            }
            else
            {
                _model.AllAlbums        = _facade.GetAlbumRep().GetAllAlbums();
                _model.GetSelectedAlbum = id != null?_model.AllAlbums.FirstOrDefault(a => a.id == id) : _model.AllAlbums.FirstOrDefault();
            }
            return(View(_model));
        }
        void CheckIsLoaded(ViewMode mode)
        {
            //Shortciruit for designer
            if (requestHandler == null)
            {
                return;
            }

            switch (mode)
            {
            case ViewMode.Classic:
                if (!classicLoaded)
                {
                    classicLoaded = true;
                    ClassicArtistViewModels.Clear();

                    foreach (Artist artist in requestHandler.GenerateArtistList())
                    {
                        ClassicArtistViewModels.Add(new ArtistViewModel(artist, ViewMode.Classic));
                    }
                }
                break;

            case ViewMode.Simple:
                if (!simpleLoaded)
                {
                    simpleLoaded = true;
                    SimpleViewModels.Clear();

                    foreach (Artist artist in requestHandler.GenerateArtistList())
                    {
                        SimpleViewModels.Add(new ArtistViewModel(artist, ViewMode.Simple));
                    }
                }
                break;

            case ViewMode.Album:
                if (!albumLoaded)
                {
                    albumLoaded = true;
                    AlbumViewModels.Clear();

                    foreach (Album album in requestHandler.GenerateAlbumList())
                    {
                        AlbumViewModels.Add(new AlbumViewModel(album, null));
                    }
                }
                break;

            case ViewMode.Directory:
                if (!directoryLoaded)
                {
                    directoryLoaded = true;
                    DirectoryViewModels.Clear();

                    foreach (DirectoryDTO directory in requestHandler.GetDirectories(""))
                    {
                        DirectoryViewModels.Add(new DirectoryViewModel(directory, null));
                    }
                }
                break;

            case ViewMode.MAX:
            default:
                throw new Exception($"Unexpected ViewMode: {mode}");
            }
        }