Ejemplo n.º 1
0
        public async Task AddToPrintQueue(int licenseId, long userId)
        {
            if (!await _licenseRepo.ContainsId(licenseId))
            {
                throw new System.ArgumentException("Invalid Argument", string.Empty);
            }

            if (await _printQueueRepo.GetPrintQueueCount(userId) >= 120)
            {
                throw new System.ApplicationException("Max number of licenses in print queue");
            }

            var printQueueEntry = new PrintQueue(userId, licenseId);

            if (!printQueueEntry.IsValid())
            {
                throw new System.ArgumentException("Invalid Argument", string.Empty);
            }

            await _printQueueRepo.Insert(printQueueEntry);

            await _printQueueRepo.SaveAsync();
        }
Ejemplo n.º 2
0
 public async Task RemoveFromPrintQueue(int licenseId)
 {
     _printQueueRepo.Delete(licenseId, GetCurrentUserId());
     await _printQueueRepo.SaveAsync();
 }