private void DeleteOldBoards(TypeOfBoards name) { var tempInformationBoards = InformationBoards.Where(x => x.FunctionName == name).ToList(); var tempInformationBoardsWithoutNewestBoard = tempInformationBoards.Where(x => x.ID < tempInformationBoards.OrderByDescending(y => x.ID).LastOrDefault().ID).ToList(); foreach (var board in tempInformationBoardsWithoutNewestBoard) { InformationBoards.Remove(board); } SaveChanges(); }
public void DeleteBoardFromDatabase(string token) { var board = InformationBoards.SingleOrDefault(x => x.Token == token); try { InformationBoards.Remove(board); SaveChanges(); } catch (Exception ex) { Console.WriteLine(ex); } }