コード例 #1
0
        public Board CreateBoard(Board board)
        {
            if (board.BoardEvent == null || board.BoardEvent.ForeignId.Equals(""))
            {
                throw new InvalidOperationException();
            }
            var existingBoard = _boardRepository.GetByBoardEventAndForeignId(board.BoardEvent, board.BoardEvent.ForeignId);

            if (existingBoard == null)
            {
                return(_boardRepository.Save(board));
            }
            else
            {
                throw new DuplicateEntityException($"Board with Event Type  [{board.BoardEvent.Type}] and ForeignId [{board.BoardEvent.ForeignId}] already exists");
            }
        }