コード例 #1
0
        public static void CreateBoard(string BoardName, int UserId)
        {
            LinqToSQLDataContext db = new LinqToSQLDataContext();

            //Create new Board

            TBoard newBoard = new TBoard()
            {
                BoardName = BoardName,
                UserId    = UserId
            };

            //Add new Board to database
            db.TBoards.InsertOnSubmit(newBoard);

            //Save changes to Database.
            try
            {
                db.SubmitChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
コード例 #2
0
        public static void DeleteBoard(int BoardId)
        {
            LinqToSQLDataContext db = new LinqToSQLDataContext();

            //Get Board to be deleted
            TBoard boardToBeDeleted = db.TBoards.FirstOrDefault(b => b.BoardId.Equals(BoardId));

            //Delete Board on database
            db.TBoards.DeleteOnSubmit(boardToBeDeleted);

            //Save changes to Database.
            try
            {
                db.SubmitChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
コード例 #3
0
 partial void DeleteTBoard(TBoard instance);
コード例 #4
0
 partial void UpdateTBoard(TBoard instance);
コード例 #5
0
 partial void InsertTBoard(TBoard instance);
コード例 #6
0
 private void detach_TBoards(TBoard entity)
 {
     this.SendPropertyChanging();
     entity.TUser = null;
 }
コード例 #7
0
 private void attach_TBoards(TBoard entity)
 {
     this.SendPropertyChanging();
     entity.TUser = this;
 }