示例#1
0
        public async Task <IActionResult> Get()
        {
            // only system admins can access this functionality
            //if (!await _securityHelper.IsSysAdmin())
            //    return new HttpStatusCodeResult(403); // Forbidden

            List <SubscriptionView> rtnView = new List <SubscriptionView>();

            // get group managers
            List <DocumentDbRepositories.ScampSubscription> subList = await _settingsRepository.GetSubscriptions();

            // build the return set
            foreach (DocumentDbRepositories.ScampSubscription sub in subList)
            {
                // build summary view object
                SubscriptionView newSubscription = new SubscriptionView()
                {
                    Id   = sub.Id,
                    Name = sub.Name,
                    AzureSubscriptionId = sub.AzureSubscriptionID,
                    AzureAdminUser      = sub.AzureAdminUser
                };
                rtnView.Add(newSubscription);  // add it to the collection
            }

            // return list
            return(new ObjectResult(rtnView)
            {
                StatusCode = 200
            });
        }
示例#2
0
        public async Task <ScampSubscription> GetAvailabeDeploymentSubscription()
        {
            //Need to add the logic of choosing a subscription.
            //For now is the first in the store
            var c = await _settingsRepository.GetSubscriptions();

            var selected = c.LastOrDefault();

            selected.AzureManagementThumbnail = await _keyRepository.GetSecret(selected.Id, "cert");

            return(selected);
        }