Exemple #1
0
        private void onClick(object sender, RoutedEventArgs e)
        {
            if (postList.SelectedItem != null)
            {
                int   selectedIndex = Int32.Parse(postList.SelectedValue.ToString().Split()[0]);
                var   context       = new Model1Container();
                Posts post          = context.Posts.Find(selectedIndex);

                TextRange range = new TextRange(textContent.Document.ContentStart, textContent.Document.ContentEnd);
                post.Body = range.Text;
                context.SaveChanges();
            }
        }
Exemple #2
0
        private void addUser_clicked(object sender, RoutedEventArgs e)
        {
            var context = new Model1Container();
            var user    = new Users()
            {
                Email    = emailTextBox.Text,
                Password = passwordTextBox.Password,
                Username = usernameTextBox.Text
            };

            context.Users.Add(user);
            context.SaveChanges();
            emailTextBox.Clear();
            passwordTextBox.Clear();
            usernameTextBox.Clear();
        }
Exemple #3
0
 public void Dispose()
 {
     context.SaveChanges();
 }