Exemplo n.º 1
0
        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");
        }
Exemplo n.º 2
0
 public void InsertEntry(GuestbookEntry ge)
 {
     Guests.Insert(0, ge);
     SerializeObject(ConfigurationManager.AppSettings["GuestbookFilePath"], this);
 }
Exemplo n.º 3
0
 public void EditEntry(int index, GuestbookEntry ge)
 {
     Guests.RemoveAt(index);
     Guests.Insert(index, ge);
     SerializeObject(ConfigurationManager.AppSettings["GuestbookFilePath"], this);
 }