Пример #1
0
        public string AddBoard(BoardGroup board)
        {
            var           mapper = Common.GetMapper();
            BoardGroupDao dao    = new BoardGroupDao(mapper);

            return(dao.Add(board).ID);
        }
Пример #2
0
        public bool UpdateBoard(BoardGroup board)
        {
            if (board == null)
            {
                throw new XinLuClubException(400, "board不能为null");
            }
            if (string.IsNullOrEmpty(board.ID))
            {
                throw new XinLuClubException(400, "boardID不能为空");
            }
            TopicBLL bll = new TopicBLL();

            return(bll.UpdateBoard(new BoardGroupUpdateForm
            {
                Entity = new BoardGroup
                {
                    Name = board.Name,
                    Description = board.Description,
                    Enabled = board.Enabled,
                },
                QueryForm = new BoardGroupQueryForm
                {
                    ID = board.ID
                }
            }));
        }
Пример #3
0
        public string AddBoard(BoardGroup board)
        {
            if (board == null)
            {
                throw new XinLuClubException(400, "board不能为null");
            }
            TopicBLL bll = new TopicBLL();

            return(bll.AddBoard(board));
        }
Пример #4
0
        public async Task <BoardGroup> UpsertAsync(BoardGroup boardGroup)
        {
            var current = await _db.BoardGroups.FirstOrDefaultAsync(x => x.Id == boardGroup.Id);

            if (null == current)
            {
                _db.BoardGroups.Add(boardGroup);
            }
            else
            {
                _db.Entry(current).CurrentValues.SetValues(boardGroup);
            }
            await _db.SaveChangesAsync();

            return(boardGroup);
        }