public async Task GetAllPostsForThread(int boardId, int threadId) { var result = await _client.GetJsonAsync <BoardDTO>(API + "boards/" + boardId + "/threads/" + threadId + "/posts/"); if (result.thread == null) { if (Board == null) { Board = new BoardDTO(); } Board.message = result.message; _uriHelper.NavigateTo("/404"); return; } if (Board != null && Board.threads != null) { result.threads = Board.threads; } result.thread.posts = result.thread.posts.OrderBy(e => e.createdDate); Board = result; NotifyStateChanged(); return; }
public async Task PostThread(int boardId, string content, string image) { var result = await _client.SendJsonAsync <BoardDTO>( HttpMethod.Post, API + "boards/" + boardId + "/threads/", new ThreadDTO() { boardId = boardId, post = new PostDTO() { content = content, image = image } }); if (Board == null) { Board = result; } else { Board.id = result.id; Board.thread = result.thread; } NotifyStateChanged(); }
public async Task GetAllThreadsForBoard(int boardId) { var result = await _client.GetJsonAsync <BoardDTO>(API + "boards/" + boardId + "/threads/"); if (result == null) { _uriHelper.NavigateTo("/404"); return; } if (Board != null && Board.thread != null && Board.id == result.id) { result.thread = Board.thread; } result.threads = result.threads.OrderByDescending(e => e.bumpDate); Board = result; NotifyStateChanged(); return; }