public AutorsController(EditoraContext context, IMapper mapper, AutorServices autorServices, LivroServices livroServices) { this.AutorServices = autorServices; this.LivroServices = livroServices; this.mapper = mapper; _context = context; }
public LivrosController(ILivroApi livroApi, IAutorApi autorApi, LivroServices livroServices, AutorServices autorServices, IMapper mapper, WebApiContext context) { this.livroApi = livroApi; this.autorApi = autorApi; this.LivroServices = livroServices; this.AutorServices = autorServices; this.mapper = mapper; this._context = context; }
private async void PopulaListas() { List <Autor> autores = await AutorServices.GetAutores(); comboBoxAutor.DataSource = autores; comboBoxAutor.DisplayMember = "nome"; comboBoxAutor.ValueMember = "id_autor"; List <Livro> livros = await LivroServices.GetLivros(); comboBoxLivro.DataSource = livros; comboBoxLivro.DisplayMember = "nome"; comboBoxLivro.ValueMember = "id_livro"; }
private async void DataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) { Autor autor = (Autor)dataGridView1.CurrentRow.DataBoundItem; string retorno = await AutorServices.PutAutor(autor); if (retorno == "OK") { //MessageBox.Show("Alterado com sucesso!"); AtualizaTela(); } else { MessageBox.Show("Erro na alteração!"); } }
private async void BtnCriar_Click(object sender, EventArgs e) { Autor autor = new Autor(); autor.nome = txtNomeAutor.Text; string resposta = await AutorServices.PostAutor(autor); if (resposta == "OK") { MessageBox.Show("Autor adicionado com sucesso!"); Close(); } else { MessageBox.Show("Erro ao adicionar autor!"); } }
private async void Excluir_Click(object sender, EventArgs e) { try { Autor autor = (Autor)dataGridView1.SelectedRows[0].DataBoundItem; string retorno = await AutorServices.DeleteAutor(autor); if (retorno == "OK") { MessageBox.Show("Excluído com sucesso!"); AtualizaTela(); } else { MessageBox.Show("Erro na exclusão!"); } } catch (ArgumentOutOfRangeException) { MessageBox.Show("Selecione a linha inteira para realizar a exclusão!"); } }
public AutorController(AutorServices AutorServices) { this._AutorService = AutorServices; }
private async void AtualizaTela() { List <Autor> lista = await AutorServices.GetAutores(); dataGridView1.DataSource = lista; }
public HomeController(ILogger <HomeController> logger, AutorServices services, LivroServices services2) { _logger = logger; this.services = services; this.services2 = services2; }