コード例 #1
0
        public ActionResult GuardarArtista(Artista artiista)
        {
            ArtistaRepositorio artistaRepo = new ArtistaRepositorio();

            artistaRepo.GuardarArtista(artiista);
            ViewBag.Artista = "artista publicado con exito";
            return(View());
        }
コード例 #2
0
        private void InitRepositorio <T>()
        {
            if (typeof(T) == typeof(Estilo) && _repoEsitlo == null)
            {
                _repoEsitlo = new EstiloRepositorio();
                return;
            }

            if (typeof(T) == typeof(Pessoa) && _repoPessoa == null)
            {
                _repoPessoa = new PessoaRepositorio();
                return;
            }

            if (typeof(T) == typeof(Cidade) && _repoCidade == null)
            {
                _repoCidade = new CidadeRepositorio();
                return;
            }

            if (typeof(T) == typeof(Artista) && _repoArtista == null)
            {
                _repoArtista = new ArtistaRepositorio();
                return;
            }

            if (typeof(T) == typeof(Album) && _repoAlbum == null)
            {
                _repoAlbum = new AlbumRepositorio();
                return;
            }

            if (typeof(T) == typeof(Musica) && _repoMusica == null)
            {
                _repoMusica = new MusicaRepositorio();
                return;
            }

            throw new NotImplementedException("Não Implementado para o tipo: " + typeof(T));
        }