protected void btnSave_Click(object sender, EventArgs e) { if (!Page.IsValid) return; GuestbookEntry ge = new GuestbookEntry { Id = new Guid(), Name = txtName.Text, Text = txtText.Text, Email = txtEmail.Text, Date = DateTime.Now.ToString() }; g.InsertEntry(ge); Response.Redirect("Guestbook.aspx"); }
public void InsertEntry(GuestbookEntry ge) { Guests.Insert(0, ge); SerializeObject(ConfigurationManager.AppSettings["GuestbookFilePath"], this); }
public void EditEntry(int index, GuestbookEntry ge) { Guests.RemoveAt(index); Guests.Insert(index, ge); SerializeObject(ConfigurationManager.AppSettings["GuestbookFilePath"], this); }