Пример #1
0
        protected void btnSubmit_Click(object Sender, EventArgs e)
        {
            String nick  = this.txtNick.Text;
            String title = this.txtTitle.Text;
            String note  = this.txtNote.Text;

            if (!GuestBook.Add(nick, title, note))
            {
                this.lblMsg.Text = "留言失败";
            }

            BindData();
        }
Пример #2
0
        public ActionResult Create(GuestEntry entry)
        {
            if (entry.Name == "Fido")
            {
                throw new InvalidOperationException("No dogs allowed");
            }

            var book = new GuestBook();

            book.Add(entry);

            return(RedirectToAction("List"));
        }