Пример #1
0
 public User AddUser(string name)
 {
     var users = db.GetCollection<User>("Users");
     var newUser = new User { Username = name };
     users.Insert<User>(newUser);
     return newUser;
 }
Пример #2
0
 public void AddPost(User user, string text)
 {
     var posts = db.GetCollection<Post>("Posts");
     var post = new Post
     {
         CreatedBy = user,
         CreatedOn = DateTime.Now,
         Text = text
     };
     posts.Insert<Post>(post);
 }
Пример #3
0
 private void LoginBtnClick(object sender, RoutedEventArgs e)
 {
     var username = LoginTB.Text;
     this.currentUser = ReturnUserFromDB(username);
     LoginGrid.Visibility = Visibility.Collapsed;
     PostsGrid.Visibility = Visibility.Visible;
     PostTB.Focusable = true;
     Keyboard.Focus(PostTB);
     LoginBTN.IsDefault = false;
     SendBTN.IsDefault= true;
 }