Esempio n. 1
0
        public async Task AddPartnerPlatformDataToSubscription(Office365SubscriptionModel model)
        {
            var subscription = await _dbContext.Office365Subscriptions
                               .Include(o => o.Office365Offer)
                               .Include(c => c.Office365Customer)
                               .FirstOrDefaultAsync(s => s.Office365Customer.Office365Id == model.Office365CustomerId &&
                                                    s.Office365Offer.CloudPlusProductIdentifier == model.Office365Offer.CloudPlusProductIdentifier);

            subscription.Office365SubscriptionId = model.Office365SubscriptionId;
            subscription.Office365OrderId        = model.Office365OrderId;

            await _dbContext.SaveChangesAsync();
        }
Esempio n. 2
0
        public async Task <Office365SubscriptionModel> CreateSubscription(Office365SubscriptionModel model)
        {
            _dbContext.Office365Subscriptions.Add(new Office365Subscription
            {
                Office365SubscriptionId = model.Office365SubscriptionId,
                Office365OrderId        = model.Office365OrderId,
                Office365FriendlyName   = model.Office365FriendlyName,
                Quantity          = model.Quantity,
                SubscriptionState = model.SubscriptionState,
                Office365Customer = _dbContext.Office365Customers.FirstOrDefault(c => c.Office365Id == model.Office365CustomerId),
                Office365Offer    = _dbContext.Office365Offers
                                    .FirstOrDefault(o => o.CloudPlusProductIdentifier == model.Office365Offer.CloudPlusProductIdentifier),
            });

            await _dbContext.SaveChangesAsync();

            return(model);
        }