public ActionResult UpdateGenre(int? id) { _facade = new DataAccessLayerfacade(); _model = new GenreViewModel(); _model.GetSelectedGenre = _facade.GetGenreRep().GetGenreById(id); return View(_model); }
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); }