public async Task DeleteLicense(int[] ids) { foreach (int id in ids) { if (!(await _licenseRepo.ContainsId(id))) { throw new System.ArgumentException("Delete Failed"); } } await _licenseDomainService.DeleteLicense(ids, GetCurrentUserId()); }
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(); }