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); } }
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); } }
partial void DeleteTBoard(TBoard instance);
partial void UpdateTBoard(TBoard instance);
partial void InsertTBoard(TBoard instance);
private void detach_TBoards(TBoard entity) { this.SendPropertyChanging(); entity.TUser = null; }
private void attach_TBoards(TBoard entity) { this.SendPropertyChanging(); entity.TUser = this; }