public bool TryUpdateBoard(Domain.Models.Board.Board board, string link) { var boardRecord = boardConverter.Convert(board); boardRecord.Link = link; var delete = dataBase.TryDeleteBoard(link); var isAddingAccessRecordSuccess = true; switch (boardRecord.AccessType) { case AccessTypeRecord.Public: break; case AccessTypeRecord.Private: var record = privateAccessConverter.Convert((PrivateAccessParameters)board.AccessParameters); record.Link = boardRecord.Link; isAddingAccessRecordSuccess = dataBase.TryAddRecord(record, out var _); break; default: throw new NotImplementedException(); } return(delete && isAddingAccessRecordSuccess && dataBase.TryAddRecord(boardRecord, out var _)); }
public bool TryGetBoard(string link, out Domain.Models.Board.Board board) { if (dataBase.TryGetRecord <BoardRecord>(x => x.Link == link, out var boardRecord)) { board = boardConverter.Convert(boardRecord); return(true); } board = null; return(false); }