예제 #1
0
        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);
            }
        }
예제 #2
0
        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);
        }