Пример #1
0
        public async Task <ResponseLivroGet> Get(int isbn)
        {
            ResponseLivroGet result = new ResponseLivroGet();

            var retorno = await LivroService.Obter(isbn);

            if (retorno != null)
            {
                Livro livro = new Livro
                {
                    Isbn          = retorno.Isbn,
                    Titulo        = retorno.Titulo,
                    AnoLancamento = retorno.AnoLancamento,
                    Valor         = retorno.Valor
                };

                // Obter a editora do livro atraves do EditoraService
                foreach (int editoraId in retorno.Editoras)
                {
                    livro.Editoras.Add(await EditoraService.Obter(editoraId));
                }

                foreach (int autorId in retorno.Autores)
                {
                    livro.Autores.Add(await AutorService.Obter(autorId));
                }

                result.Livros.Add(livro);
            }
            return(result);
        }
        private void ZapiszZmianyBTN_Click(object sender, RoutedEventArgs e)
        {
            var authorsService = new AutorService();

            _dto.Nazwisko = AutorNazwiskoTxtBox.Text;
            authorsService.UpdateAutor(_dto);
            this.Close();
        }
        private void Zapisz_Click(object sender, RoutedEventArgs e)
        {
            string nazwisko = NazwiskoAutoraTxtBox.Text;
            var    service  = new AutorService();

            service.AddAutor(nazwisko);
            this.Close();
        }
Пример #4
0
        public ReporteLibrosParametrizado()
        {
            InitializeComponent();

            oSoporteForm      = new SoporteForm();
            oAutorService     = new AutorService();
            oGeneroService    = new GeneroService();
            oEditorialService = new EditorialService();
        }
Пример #5
0
 public EjemplarController()
 {
     eS  = new EjemplarServiceImp();
     lS  = new LibroServiceImp();
     aS  = new AutorServiceImp();
     edS = new EditorialServiceImp();
     pS  = new PrestamoServiceImp();
     uS  = new UsuarioServiceImp();
 }
Пример #6
0
        public async Task <ResponseAutorGet> Get()
        {
            ResponseAutorGet result = new ResponseAutorGet();

            var retorno = await AutorService.Obter();

            result.Autores = retorno.ToList();

            return(result);
        }
Пример #7
0
        public async Task <ResponseAutorGet> Get(int id)
        {
            ResponseAutorGet result = new ResponseAutorGet();

            var retorno = await AutorService.Obter(id);

            result.Autores.Add(retorno);

            return(result);
        }
Пример #8
0
        public void Autor_FormatarNomeComSobrenome_ReTornaNomeFormatado()
        {
            //Arrange
            var autorService = new AutorService();

            //Act
            var resultado = autorService.FormatarNomeComSobrenome(new string[] { "joice", "lopes", "da", "silva" });

            //Assert
            Assert.Equal(expected: "SILVA, Joice Lopes da", actual: resultado);
        }
Пример #9
0
        public void Autor_FormatarNomeSemSobrenome_ReTornaNomeFormatadoCorreto(string nome, string resultadoEsperado)
        {
            //Arrange
            var autorService = new AutorService();

            //Act
            var resultado = autorService.FormatarNomeSemSobrenome(nome);

            //Assert
            Assert.Equal(expected: resultadoEsperado, actual: resultado);
        }
Пример #10
0
        public void Autor_FormatarNomeSemSobrenome_ReTornaNomeFormatado()
        {
            //Arrange
            var autorService = new AutorService();

            //Act
            var resultado = autorService.FormatarNomeSemSobrenome("silva");

            //Assert
            Assert.Equal(expected: "SILVA", actual: resultado);
        }
Пример #11
0
        public void ValidarNomeComAgnome_NomeContemAgnome_ReTornaFalse()
        {
            //Arrange
            var autorService = new AutorService();

            //Act
            var resultado = autorService.validarNomeComAgnome(new string[] { "antonio", "carlos", "silva" });

            //Assert
            Assert.False(resultado);
        }
Пример #12
0
        public void ValidarNomeComAgnome_NomeContemAgnome_ReTornaTrue()
        {
            //Arrange
            var autorService = new AutorService();

            //Act
            var resultado = autorService.validarNomeComAgnome(new string[] { "FILHO", "filha", "NETO", "neta", "SOBRINHO", "SOBRINHA", "JUNIOR" });

            //Assert
            Assert.True(resultado);
        }
Пример #13
0
        public void ValidarNomeComPreposicao_NomeContemAgnome_ReTornaFalse()
        {
            //Arrange
            var autorService = new AutorService();

            //Act
            var resultado = autorService.validarNomeComPreposicao("na");

            //Assert
            Assert.False(resultado);
        }
Пример #14
0
        public void ValidarNomeComPreposicao_NomeContemAgnome_True(string nome)
        {
            //Arrange
            var autorService = new AutorService();

            //Act
            var resultado = autorService.validarNomeComPreposicao(nome);

            //Assert
            Assert.True(resultado);
        }
Пример #15
0
 public async Task <bool> Put(int id, [FromBody] RequestAutorPost request)
 {
     if (id == request.Autor.Id)
     {
         return(await AutorService.Editar(request.Autor));
     }
     else
     {
         return(false);
     }
 }
Пример #16
0
        public void Autor_Adicionar_ReTornaErroNomeVazio()
        {
            //Arrange & Act & Assert
            var autorService = new AutorService();
            var model        = new List <AutorViewModel>();
            var obj          = new AutorViewModel()
            {
                Nome = null
            };

            model.Add(obj);

            var exception = Assert.Throws <Exception>(testCode: () =>
            {
                autorService.Adicionar(model);
            });

            Assert.Equal(expected: "Nome não pode ser vazio!", actual: exception.Message);
        }
 public AutoresController()
 {
     aS = new AutorServiceImp();
 }
Пример #18
0
 public AutorController(AutorService servicio)
 {
     _servicio = servicio;
 }
Пример #19
0
 public async Task Post([FromBody] RequestAutorPost request)
 {
     await AutorService.Incluir(request.Autor);
 }
 public LibroController()
 {
     ls = new LibroServiceImp();
     As = new AutorServiceImp();
 }
Пример #21
0
 public AutoresController(AutorService service)
 {
     _Service = service;
 }
Пример #22
0
 public void TestMethod1()
 {
     var Autor      = new Autor();
     var servicio   = new AutorService(context);
     var controller = new AutorController(servicio);
 }
Пример #23
0
 public NoticiasController(NoticiaService noticiaService, AutorService autorService)
 {
     _noticiaService = noticiaService;
     _autorService   = autorService;
 }
Пример #24
0
 public AutorsController(AutorService autorService)
 {
     _autorService = autorService;
 }
Пример #25
0
 public async Task Delete(int id)
 {
     await AutorService.Remover(id);
 }
 public AutorEditView(AutorDto dto)
 {
     _dto = dto ?? throw new ArgumentNullException(nameof(dto));
     InitializeComponent();
     authorsService = new AutorService();
 }
Пример #27
0
 public AutorController()
 {
     aS = new AutorServiceImp();
     lS = new LibroServiceImp();
     eS = new EjemplarServiceImp();
 }
Пример #28
0
 public AutorController()
 {
     service    = new AutorService();
     repository = new AutorRepository();
 }
Пример #29
0
 public AutorController(AutorService autorService)
 {
     this.autorService = autorService;
 }
Пример #30
0
 public AutorController()
 {
     autorService = new AutorServiceImp();
 }