/// <summary> /// The AddToStock /// </summary> /// <param name="id">The id<see cref="int"/></param> /// <param name="count">The count<see cref="int"/></param> public void AddToStock(int id, int count = 1) { var locker = LockFile("product.lk"); if (_marketRepository.FindProduct(id) == null) { UnlockFile(locker); throw new InvalidOperationException("This product does not exist."); } if (count <= 0) { UnlockFile(locker); throw new ArgumentOutOfRangeException("count", "Count cannot less than 1."); } var locker2 = LockFile("stock.lk"); _marketRepository.AddToStock(id, count); UnlockFile(locker2); UnlockFile(locker); }