예제 #1
0
        public List<Subscription> GetSubscriptionList([FromBody]string [] wapSubscriptions)
        {
            //Null parameter check
            if (wapSubscriptions == null)
                return Enumerable.Empty<Subscription>().ToList();

            var cwdb = new CmpWapDb();
            List<Subscription> resultList = new List<Subscription>();

            foreach (var wapSubscription in wapSubscriptions)
            {
                var planName = cwdb.GetPlanMappedToWapSubscription(wapSubscription);
                var spas = cwdb.FetchServiceProviderAccountsAssociatedWithPlan(planName);
                resultList.AddRange(spas.Select(spa => new Subscription
                {
                    WapSubscriptionId = wapSubscription, 
                    PlanNameId = planName, 
                    AzureSubscriptionId = spa.AccountID
                }));
            }
            return resultList;
        }
예제 #2
0
        //*********************************************************************
        ///
        /// <summary>
        /// This method fetches Resource Group information from WAP DB.
        /// </summary>
        /// <param name="wapSubscriptionId"></param>
        ///
        //*********************************************************************

        private IEnumerable <ResourceProviderAcctGroup> FetchResourceGroupFromDb(string wapSubscriptionId)
        {
            ICmpWapDb cwdb = new CmpWapDb();

            var planId = cwdb.GetPlanMappedToWapSubscription(wapSubscriptionId);
            var spas   = cwdb.FetchServiceProviderAccountsAssociatedWithPlan(planId);

            return(spas.Select(spa => new ResourceProviderAcctGroup()
            {
                AdDomainMap = null,
                Name = spa.ResourceGroup,
                CreatedBy = "CmpWapExtension",
                CreatedOn = DateTime.Now,
                DomainId = 1,
                EnvironmentType = null,
                EnvironmentTypeId = 1,
                IsActive = true,
                LastUpdatedBy = "CmpWapExtension",
                LastUpdatedOn = DateTime.Now,
                NetworkNIC = null,
                NetworkNICId = 0,
                ResourceProviderAcctGroupId = 1
            }).ToList());
        }