Example #1
0
        protected void GVAlbum_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int         index = Convert.ToInt32(e.CommandArgument);
            GridViewRow row   = GVAlbum.Rows[index];

            int id = Convert.ToInt32(row.Cells[0].Text);

            var db = new AlbumDB();

            if (e.CommandName == "Excluir")
            {
                db.Delete(id);
                LoadGrid();
            }
            else if (e.CommandName == "Editar")
            {
                Album album = db.SelectById(id);

                TxtNomeAlbum.Text  = album.Nome;
                TxtLancamento.Text = album.Lancamento;
                TxtGravadora.Text  = album.Gravadora;
                DdlArtista.Text    = album.Artista;
                IdH.Value          = album.Id.ToString();
            }
        }
 /// <summary>
 /// Delete a Album by the primary key
 /// </summary>
 /// <param name="album"></param>
 public int Delete(Album album)
 {
     return(albumDb.Delete(album, deleteMethod));
 }