protected void gvGerenciamentoLivros_RowEditing(object sender, GridViewEditEventArgs e) { // pegar o valor default para as dropdownlists var currentRow = gvGerenciamentoLivros.Rows[e.NewEditIndex]; var loAutorName = (currentRow.FindControl("lblAutorLivro") as Label).Text; var index = ListaAutores.IndexOf(ListaAutores.Single(a => a.aut_nm_nome == loAutorName)); gvGerenciamentoLivros.EditIndex = e.NewEditIndex; CarregaDados(); // carregar as dropdown lists de cada modelo (autor, categoria e editor) para edição // categoria DropDownList gvDropDownListCategoria = (gvGerenciamentoLivros.Rows[e.NewEditIndex].FindControl("ddlEditCategoriaLivro") as DropDownList); CarregaDropDownList(gvDropDownListCategoria, "TipoLivroDescricao", "TipoLivroId", CreateCategoriaDataSource); // autor DropDownList gvDropDownListAutor = (gvGerenciamentoLivros.Rows[e.NewEditIndex].FindControl("ddlEditAutorLivro") as DropDownList); CarregaDropDownList(gvDropDownListAutor, "AutorNome", "AutorId", CreateAutorDataSource); gvDropDownListAutor.SelectedIndex = index; // editor DropDownList gvDropDownListEditor = (gvGerenciamentoLivros.Rows[e.NewEditIndex].FindControl("ddlEditEditorLivro") as DropDownList); CarregaDropDownList(gvDropDownListEditor, "EditorNome", "EditorId", CreateEditorDataSource); }
public ProtocoloDeRetorno.AoRealizarListaAutores Realizar(ListaAutores listaAutores) { var retorno = new ProtocoloDeRetorno.AoRealizarListaAutores(); var retornoAoListarDeRepositorioAutor = repAutor.Listar(); if (retornoAoListarDeRepositorioAutor.Problemas.Count > 0) { retorno.Mensagem = "Não foi possível listar os autores."; retorno.Problemas.AddRange(retornoAoListarDeRepositorioAutor.Problemas); } else { retorno.Autores = new List <TAutor>(); foreach (var item in retornoAoListarDeRepositorioAutor.Autores) { retorno.Autores.Add(new TAutor { AutorId = item.AutorId, Nome = item.Nome.Nome, Sobrenome = item.Nome.Sobrenome, Email = item.Email.Endereco }); } } return(retorno); }
public async Task <List <Autor> > Handle(ListaAutores request, CancellationToken cancellationToken) { var autores = await _context.tblAutor.ToListAsync(); return(autores); }