private void btnNovo_Click(object sender, System.EventArgs e) { var frm = new frmEditAventura(); if (frm.ShowDialog() != DialogResult.OK) { return; } var av = frm.Aventura; _aventuraContexto.AddOrUpdate(av); CarregarItens(); }
private void btnEditar_Click(object sender, System.EventArgs e) { if (lvAventuras.SelectedItems.Count <= 0) { MessageBox.Show("Selecione um item!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } var key = lvAventuras.SelectedItems[0].ImageKey; var item = _aventuraContexto.Get(int.Parse(key)); var f = new frmEditAventura(item); if (f.ShowDialog() != DialogResult.OK) { return; } item = f.Aventura; _aventuraContexto.AddOrUpdate(item); CarregarItens(); }