public User AddUser(string name) { var users = db.GetCollection<User>("Users"); var newUser = new User { Username = name }; users.Insert<User>(newUser); return newUser; }
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); }
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; }