Beispiel #1
0
        public async Task DeleteColumn_Test()
        {
            // Arrange
            var board  = CreateBoard();
            var column = AddColumn(board);

            // Act
            var response = await Client.DeleteAsync($"/boards/{board.Id}/columns/{column.Id}");

            // Assert
            await AssertResponse.NoContentSuccessAsync(response);

            Assert.Empty(ColumnService.GetColumns(board.Id));
        }
Beispiel #2
0
        public async Task DeleteBoard_Test()
        {
            // Arrange
            var board  = CreateBoard();
            var column = AddColumn(board);

            AddColumn(board);
            AddColumn(board);
            AddCard(column);
            AddCard(column);
            AddCard(column);

            // Act
            var response = await Client.DeleteAsync($"/boards/{board.Id}");

            await AssertResponse.NoContentSuccessAsync(response);

            Assert.Throws <BoardNotFoundException>(() => BoardService.GetBoard(board.Id));
            Assert.Throws <BoardNotFoundException>(() => ColumnService.GetColumns(board.Id));
            Assert.Throws <BoardNotFoundException>(() => CardService.GetCards(board.Id, column.Id));
        }
Beispiel #3
0
        public ActionResult GetColumnList()
        {
            if (!TomeltServices.Authorizer.Authorize(ArticleManagePermissions.ViewContent, T("无权限")))
            {
                return(new HttpUnauthorizedResult());
            }
            var rows = ColumnService.GetColumns(VersionOptions.Latest).OrderBy <ColumnPartRecord>(d => d.Sort).List();

            return(Json(new
            {
                total = rows.Count(),
                rows = rows.Select(d => new
                {
                    d.Id,
                    d.As <ColumnPart>().ParentId,
                    HasPublished = d.HasPublished(),
                    d.As <ColumnPart>().Sort,
                    d.As <TitlePart>().Title,
                    Count = ArticleService.GetArticlesCountByColumnId(d.Id),
                    _parentId = d.As <ColumnPart>().ParentId == 0 ? null : d.As <ColumnPart>().ParentId.ToString()
                })
            }));
        }
 public ActionResult Index()
 {
     return(View(columnService.GetColumns()));
 }