예제 #1
0
        public async Task <BoardDTO> GetAllThreadsForBoard(string boardName)
        {
            var board = await _cache.GetObjectAsync <BoardDTO>(RoutePaths.ThreadsRoute(boardName));

            if (board == null)
            {
                board = await _work.PostRepository.GetAllThreadsForBoard(boardName);

                await _cache.SetObjectAsync(RoutePaths.ThreadsRoute(boardName), board);
            }
            return(board);
        }
예제 #2
0
        public async Task <BoardDTO> PostThread(string boardName, PostDTO thread)
        {
            var post = await _work.PostRepository.PostThread(boardName, thread);

            await _work.SaveChangesAsync();

            var board = await _work.PostRepository.GetAllThreadsForBoard(boardName);

            await _cache.SetObjectAsync(RoutePaths.ThreadsRoute(boardName), board);

            board = await _work.PostRepository.GetAllPostsForThread(boardName, post.IdEffective);

            await _cache.SetObjectAsync(RoutePaths.PostsRoute(boardName, board.CurrentThread.Id), board);

            return(board);
        }