Esempio n. 1
0
 public ActionResult Index(int? id)
 {
     _facade = new DataAccessLayerfacade();
     _model = new GenreViewModel();
     if (_facade.GetGenreRep().GetAllGenres().Count == 0)
     {
         _model.AllGenres = _facade.GetGenreRep().GetAllGenres();
     }
     else
     {
         _model.AllGenres = _facade.GetGenreRep().GetAllGenres();
         _model.GetSelectedGenre = id != null ? _model.AllGenres.FirstOrDefault(a => a.id == id) : _model.AllGenres.FirstOrDefault();
     }
     return View(_model);
 }
Esempio n. 2
0
 public ActionResult UpdateGenre(int? id)
 {
     _facade = new DataAccessLayerfacade();
     _model = new GenreViewModel();
     _model.GetSelectedGenre = _facade.GetGenreRep().GetGenreById(id);
     return View(_model);
 }
Esempio n. 3
0
 public ActionResult CreateAlbum()
 {
     _facade = new DataAccessLayerfacade();
     var model = new AlbumViewModels();
     model.AllArtists = _facade.GetArtistRep().GetAllArtist();
     model.AllGenres = _facade.GetGenreRep().GetAllGenres();
     return View(model);
 }
Esempio n. 4
0
        public ActionResult UpdateAlbum(Album model)
        {
            _facade = new DataAccessLayerfacade();
            model.Artist = _facade.GetArtistRep().GetArtistById(model.artistId);
            model.Genre = _facade.GetGenreRep().GetGenreById(model.genreId);

            _facade.GetAlbumRep().Update(model);

            return RedirectToAction("Index");
        }
Esempio n. 5
0
 public ActionResult DeleteGenre(int id)
 {
     _facade = new DataAccessLayerfacade();
     _facade.GetGenreRep().DeleteGenre(id);
     return RedirectToAction("Index");
 }
Esempio n. 6
0
 public ActionResult UpdateGenre(Genre genre)
 {
     _facade = new DataAccessLayerfacade();
     _facade.GetGenreRep().UpdateGenre(genre);
     return RedirectToAction("Index");
 }
Esempio n. 7
0
 public ActionResult CreateGenre(GenreModel model)
 {
     _facade = new DataAccessLayerfacade();
     _facade.GetGenreRep().CreateGenre(new Genre { name = model.Name });
     return RedirectToAction("Index");
 }