public void Remove(HotseatSavedGameInfo savedGameInfo) { using (DbContextTransaction transaction = Database.BeginTransaction()) { try { var objectToBeRemoved = HotseatSavedGameInfos.First(x => x.Id == savedGameInfo.Id); string path = objectToBeRemoved.Path; HotseatSavedGameInfos.Remove(objectToBeRemoved); File.Delete(path); SaveChanges(); transaction.Commit(); } catch (Exception) { transaction.Rollback(); throw; } } }
public byte[] LoadGame(HotseatSavedGameInfo info) { var savedGameInfo = HotseatSavedGameInfos.First(x => x.Id == info.Id); return(savedGameInfo.GetFileBytes()); }