Ejemplo n.º 1
0
        public async Task <Guid> CreateLicense(Guid productVersionId, Guid customerId, DateTime expireDate, LicenseType licenseType)
        {
            return(await unitOfWork.RunInTransactionAsync(async() =>
            {
                var productVersion = await licenseRepository.GetProductVersion(productVersionId);
                var customer = await licenseRepository.GetCustomer(customerId);

                // Create entity
                var entity = new LicenseTokenEntity
                {
                    Active = true,
                    Customer = customer,
                    EmitDate = DateTime.UtcNow,
                    ExpireDate = expireDate,
                    LicenseType = licenseType,
                    PassPhrase = passPhrase,
                    PrivateKey = "*",
                    PublicKey = "*",
                    LicFileContent = "*",
                    Version = productVersion,
                };

                await licenseRepository.CreateLicenseToken(entity);

                // update the product
                productVersion.Product.LicenseTokens.Add(entity);
                await licenseRepository.UpdateProduct(productVersion.Product);

                return entity.Id;
            }));
        }
Ejemplo n.º 2
0
 internal async Task CreateLicenseToken(LicenseTokenEntity entity)
 {
     await CreateAsync(entity);
 }
Ejemplo n.º 3
0
 internal async Task UpdateLicenseToken(LicenseTokenEntity entity)
 {
     await UpdateAsync(entity);
 }