public List <Board> GetBoards() { BulletinContext _context = new BulletinContext(); List <Board> _listOfBoard = new List <Board>(); _listOfBoard = _context.Boards.ToList(); return(_listOfBoard); }
public List <string> GetBoardNames() { BulletinContext _context = new BulletinContext(); IQueryable <string> boardnames = from _boardnames in _context.Boards select _boardnames.Name; return(boardnames.ToList()); }
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)); }
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)); }
public User() { _context = new BulletinContext(); }
public Post() { _context = new BulletinContext(); }
public Board GetBoard(int id) { BulletinContext _context = new BulletinContext(); return(_context.Boards.Find(id)); }