예제 #1
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            MessagesEntities context = new MessagesEntities();

            var messages =
                (from message in context.Messages
                select message).Take(10).OrderByDescending(m => m.Id).ToList();
            this.ListViewMessages.DataSource = messages;
            this.ListViewMessages.DataBind();
        }
예제 #2
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            MessagesEntities context = new MessagesEntities();

            var messages =
                (from message in context.Messages
                 select message).Take(10).OrderByDescending(m => m.Id).ToList();

            this.ListViewMessages.DataSource = messages;
            this.ListViewMessages.DataBind();
        }
예제 #3
0
        protected void AddMessage_Click(object sender, EventArgs e)
        {
            MessagesEntities context = new MessagesEntities();

            Message newMessage = new Message()
            {
                Text = this.NewMessage.Text
            };

            context.Messages.Add(newMessage);
            context.SaveChanges();

            this.NewMessage.Text = "";
        }
예제 #4
0
        protected void AddMessage_Click(object sender, EventArgs e)
        {
            MessagesEntities context = new MessagesEntities();

            Message newMessage = new Message()
            {
                Text = this.NewMessage.Text
            };

            context.Messages.Add(newMessage);
            context.SaveChanges();

            this.NewMessage.Text = "";
        }