public bool Lock(Cell[] cells) { if (cells.All(c => string.IsNullOrEmpty(c.LockTag))) { try { cells.AsParallel().ForAll(c => c.LockTag = this.LockKey); StorageRepository.SaveChanges(); return true; } catch (Exception) { return false; } } else { return false; } }
public void UnLock(Cell[] cells) { try { cells.AsParallel().ForAll(c => c.LockTag = string.Empty); CellRepository.SaveChanges(); } catch (Exception) { return; } }