public static async Task GetAllNotesTest() { var methods = new NoteMethod(ConnectionApi.HttpClient); var authtoken = new AuthenticationToken(ConnectionApi.HttpClient); var userMethod = new UserMethod(ConnectionApi.HttpClient); await userMethod.Login("*****@*****.**", "ss"); var token = await authtoken.PostAuthRecordAsync(userMethod.Record); IEnumerable <Note> col = await methods.GetAllNotesFromDatabase(token); foreach (var el in col) { Console.WriteLine(el.Id); } }
private async void SaveNote(object obj) { IsReadOnly = true; IsSaveButtonVisible = Visibility.Hidden; IsEditButtonVisible = Visibility.Visible; AuthenticationToken authToken = new AuthenticationToken(ConnectionApi.HttpClient); token = await authToken.PostAuthRecordAsync(_authenticationRecord); user = await methods.GetUserInfo(token, _authenticationRecord.Email); noteApi = new NoteApi(_authenticationRecord, user.Id); noteApi.UpdateNoteAsync(Note.Id, Note); OnPropertyChanged(nameof(IsSaveButtonVisible)); OnPropertyChanged(nameof(IsSaveButtonVisible)); OnPropertyChanged(nameof(IsReadOnly)); }
public static async Task PostNote() { var methods = new NoteMethod(ConnectionApi.HttpClient); var authtoken = new AuthenticationToken(ConnectionApi.HttpClient); var userMethod = new UserMethod(ConnectionApi.HttpClient); await userMethod.Login("*****@*****.**", "ss"); var token = await authtoken.PostAuthRecordAsync(userMethod.Record); var id = await UniqueId.GetUniqueBsonId(ConnectionApi.HttpClient); var Note = new Note() { Content = "test", CreateTimestamp = DateTime.Now, Id = id, LastChangeTimestamp = DateTime.Now, OwnerId = userMethod.User.Id }; methods.AddNoteToDatabase(Note, token); }
private async void getToken() { AuthenticationToken authToken = new AuthenticationToken(ConnectionApi.HttpClient); token = await authToken.PostAuthRecordAsync(_authenticationRecord); }