コード例 #1
0
        public BaseResponse <BoardOutputDto> Create(BoardInputDto boardInputDto, Guid userId)
        {
            var board = Create(Mapper.Map <Board>(boardInputDto), out var isSaved);

            if (!isSaved)
            {
                throw new InternalServerErrorException(string.Format(Error.CreateError, boardInputDto.Name));
            }

            var boardUser = new BoardUser {
                UserId = userId, BoardId = board.Id, MemberType = BoardMemberType.Admin
            };

            _boardUserService.Create(boardUser, out isSaved);
            if (!isSaved)
            {
                Delete(board);
                throw new InternalServerErrorException($"Could not add board role admin for user {userId}");
            }

            return(new SuccessResponse <BoardOutputDto>(Mapper.Map <BoardOutputDto>(board)));
        }
コード例 #2
0
 public BaseResponse <bool> Update([FromBody] BoardInputDto boardInputDto)
 {
     return(_boardService.Update(boardInputDto));
 }
コード例 #3
0
        public BaseResponse <BoardOutputDto> Create([FromBody] BoardInputDto boardInputDto)
        {
            var userId = User.GetUserId();

            return(_boardService.Create(boardInputDto, userId));
        }
コード例 #4
0
        public BaseResponse <bool> Update(BoardInputDto boardInputDto)
        {
            var isSaved = Update(Mapper.Map <Board>(boardInputDto));

            return(new SuccessResponse <bool>(isSaved));
        }