Esempio n. 1
0
        public List <Board> GetBoards()
        {
            BulletinContext _context     = new BulletinContext();
            List <Board>    _listOfBoard = new List <Board>();

            _listOfBoard = _context.Boards.ToList();
            return(_listOfBoard);
        }
Esempio n. 2
0
        public List <string> GetBoardNames()
        {
            BulletinContext     _context   = new BulletinContext();
            IQueryable <string> boardnames = from _boardnames
                                             in _context.Boards
                                             select _boardnames.Name;

            return(boardnames.ToList());
        }
Esempio n. 3
0
        public Board addBoard(Board board, User user)
        {
            BulletinContext _context = new BulletinContext();
            //Create the user in the context and add board
            User _user = _context.Users.Find(user.ID);

            _user.Boards.Add(item: board);

            //save changes
            _context.SaveChanges();
            return(_context.Boards.Find(board.ID));
        }
Esempio n. 4
0
        public Post addPost(Board board, User user, Post post)
        {
            BulletinContext _context = new BulletinContext();
            //Create the board in the context and add post
            Board _board = _context.Boards.Find(board.ID);

            _board.Posts.Add(item: post);
            //Create the user in the context and add the post
            User _user = _context.Users.Find(user.ID);

            _user.Posts.Add(item: post);
            //save changes
            _context.SaveChanges();
            return(_context.Posts.Find(post.ID));
        }
Esempio n. 5
0
 public User()
 {
     _context = new BulletinContext();
 }
Esempio n. 6
0
 public Post()
 {
     _context = new BulletinContext();
 }
Esempio n. 7
0
        public Board GetBoard(int id)
        {
            BulletinContext _context = new BulletinContext();

            return(_context.Boards.Find(id));
        }