protected void btnSalva_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(txtNumero.Text) && !string.IsNullOrWhiteSpace(txtNome.Text)) { Personaggio currentCharacter = (Personaggio)Session["Personaggio"]; using (HolonetEntities context = new HolonetEntities()) { DataAccessLayer.Rubrica elemento = new DataAccessLayer.Rubrica(); elemento.NumeroPG = currentCharacter.NumeroPG; elemento.NumeroSalvato = long.Parse(txtNumero.Text.Trim()); elemento.NomeVisualizzato = txtNome.Text.Trim(); context.AddToRubricas(elemento); context.SaveChanges(); } } carica(); }