public List <ServiceProviderAccount> UpdateServiceProviderAccount(ServiceProviderAccount sPa) { try { if (!Utilities.ValidateAadCredentials(sPa.ClientID, sPa.TenantID, sPa.ClientKey)) { throw new InvalidDataException( "The AAD credentials provided were not accepted by Azure. Please double-check for accuracy or possible mismatch between fields."); } if (0 == sPa.ID) { sPa.ExpirationDate = new DateTime(2100, 1, 1); sPa.Active = true; return(AddSpaToDb(sPa)); } return(UpdateSpaInDb(sPa)); } catch (Exception ex) { LogThis(ex, EventLogEntryType.Error, "CmpWapExtension.ServiceProviderAccountsController.UpdateServiceProviderAccount()", 100, 1); throw; } }
//********************************************************************* /// /// <summary> /// Initializes a new instance of the <see cref="AppModel" /> class. /// </summary> /// <param name="createSPAM">The domain name from API.</param> /// //********************************************************************* public ServiceProviderAccountModel(ServiceProviderAccount createSPAM) { this.ID = createSPAM.ID; this.AccountID = createSPAM.AccountID; this.AccountPassword = createSPAM.AccountPassword; this.AccountType = createSPAM.AccountType; this.Active = createSPAM.Active; this.AzAffinityGroup = createSPAM.AzAffinityGroup; this.AzRegion = createSPAM.AzRegion; this.AzStorageContainerUrl = createSPAM.AzStorageContainerUrl; this.AzSubnet = createSPAM.AzSubnet; this.AzVNet = createSPAM.AzVNet; this.CertificateBlob = createSPAM.CertificateBlob; this.CertificateThumbprint = createSPAM.CertificateThumbprint; this.Config = createSPAM.Config; this.CoreCountCurrent = createSPAM.CoreCountCurrent; this.CoreCountMax = createSPAM.CoreCountMax; this.Description = createSPAM.Description; this.ExpirationDate = createSPAM.ExpirationDate; this.Name = createSPAM.Name; this.OwnerNamesCSV = createSPAM.OwnerNamesCSV; this.ResourceGroup = createSPAM.ResourceGroup; this.TagData = createSPAM.TagData; this.TagID = createSPAM.TagID; this.TenantID = TenantID; this.ClientID = ClientID; this.ClientKey = ClientKey; this.PlanId = PlanId; }
private void ServiceProviderInsertTest() { var sp = new ServiceProviderAccountsController(); ServiceProviderAccount spA = new ServiceProviderAccount(); //spA.ID = 345; spA.Name = "Test"; spA.ClientKey = ""; string subId = ""; var result = sp.UpdateServiceProviderAccount(spA); }
//********************************************************************* /// /// <summary> /// /// </summary> /// <param name="sPa"></param> /// <returns></returns> /// //********************************************************************* private List <ServiceProviderAccount> UpdateSpaInDb(ServiceProviderAccount sPa) { var cmp = new VMServiceRepository(EventLog); var spaList = cmp.UpdateServiceProviderAccount(sPa); SpaList.Clear(); foreach (var spa in spaList) { AddSpaToList(spa); } return(spaList); }
//********************************************************************* /// /// <summary> /// This method adds Service Provider Account to Service Provider /// Account list. /// </summary> /// <param name="spa"></param> /// //********************************************************************* private void AddSpaToList(ServiceProviderAccount spa) { SpaList.Add(spa); }