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 CreateTask(string taskName, int listId) { LinqToSQLDataContext db = new LinqToSQLDataContext(); //Create new Board TTask newTask = new TTask { TaskName = taskName, TaskList = listId }; //Add new Board to database db.TTasks.InsertOnSubmit(newTask); //Save changes to Database. try { db.SubmitChanges(); } catch (Exception e) { Console.WriteLine(e); } }
public static void CreateList(string ListName, int BoardId) { LinqToSQLDataContext db = new LinqToSQLDataContext(); //Create new Board TList newList = new TList { ListName = ListName, BoardId = BoardId }; //Add new Board to database db.TLists.InsertOnSubmit(newList); //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); } }
public static void DeleteTask(int taskId) { LinqToSQLDataContext db = new LinqToSQLDataContext(); //Get Board to be deleted TTask taskToBeDeleted = db.TTasks.FirstOrDefault(t => t.TasktId.Equals(taskId)); //Delete Board on database db.TTasks.DeleteOnSubmit(taskToBeDeleted); //Save changes to Database. try { db.SubmitChanges(); } catch (Exception e) { Console.WriteLine(e); } }
public static void DeleteList(int ListId) { LinqToSQLDataContext db = new LinqToSQLDataContext(); //Get Board to be deleted TList listToBeDeleted = db.TLists.FirstOrDefault(l => l.ListId.Equals(ListId)); //Delete Board on database db.TLists.DeleteOnSubmit(listToBeDeleted); //Save changes to Database. try { db.SubmitChanges(); } catch (Exception e) { Console.WriteLine(e); } }
public static void UpdateTask(int taskId, string taskDescription, DateTime taskDue, int taskWho, int taskStatus) { LinqToSQLDataContext db = new LinqToSQLDataContext(); //Get Board to be deleted TTask taskToBeUpdated = db.TTasks.FirstOrDefault(t => t.TasktId.Equals(taskId)); taskToBeUpdated.TaskDescription = taskDescription; taskToBeUpdated.TaskDue = taskDue; taskToBeUpdated.TaskWho = taskWho; taskToBeUpdated.TaskStatus = taskStatus; //Save changes to Database. try { db.SubmitChanges(); } catch (Exception e) { Console.WriteLine(e); } }