private static void ConfigVirtualNetwork(ClusterCreateParameters cluster, HDInsight.ClusterCreateParametersV2 inputs) { // Check if the virtual network configuration is partially set if (string.IsNullOrEmpty(inputs.VirtualNetworkId) ^ string.IsNullOrEmpty(inputs.SubnetName)) { if (inputs.VirtualNetworkId == null) { throw new ArgumentException("Subnet name is set however virtual network GUID is not set."); } else { throw new ArgumentException("Virtual newtork GUID is set however subnet name is not set."); } } // Set virtual network configuration if is provided in the input if (!string.IsNullOrEmpty(inputs.VirtualNetworkId) && !string.IsNullOrEmpty(inputs.SubnetName)) { VirtualNetworkConfiguration virtualNetworkConf = new VirtualNetworkConfiguration(); virtualNetworkConf.VirtualNetworkSite = inputs.VirtualNetworkId; foreach (var role in cluster.ClusterRoleCollection) { AddressAssignment aa = new AddressAssignment(); Subnet subnet = new Subnet(); subnet.Name = inputs.SubnetName; aa.Subnets.Add(subnet); aa.Role = role; virtualNetworkConf.AddressAssignments.Add(aa); } cluster.VirtualNetworkConfiguration = virtualNetworkConf; } }
public async Task CreateUserGroupAndAssignments(string buyerID, string buyerLocationID, string token) { var assignment = new AddressAssignment { AddressID = buyerLocationID, UserGroupID = buyerLocationID, IsBilling = true, IsShipping = true }; await _oc.Addresses.SaveAssignmentAsync(buyerID, assignment, accessToken : token); }
public void AssignToAddress(Four51WebAddressAssignment address) { var assign = new AddressAssignment() { AddressInteropID = address.AddressInteropID, UseForBilling = address.UseForBilling, UseForShipping = address.UseForShipping, }; _user.AssignAddress(InteropID, assign, this.SharedSecret); }
public void AssignToAddress(Four51WebAddress Address) { AddressAssignment assign = new AddressAssignment() { AddressInteropID = Address.InteropID, UseForBilling = Address.UseForBilling, UseForShipping = Address.UseForShipping }; _group.AssignAddress(BuyerCompanyInteropID, InteropID, assign, this.SharedSecret); }
public async Task <IActionResult> Create(AddressViewModel viewModel) { if (ModelState.IsValid) { Address address = new Address(); AddressAssignment addressassignment = new AddressAssignment(); address = viewModel.Address; address.ID = Guid.NewGuid(); _context.Add(address); await _context.SaveChangesAsync(); addressassignment.ItemID = viewModel.ItemID; addressassignment.AddressID = address.ID; _context.Add(addressassignment); await _context.SaveChangesAsync(); return(RedirectToAction("Details", viewModel.ControllerName, new { id = viewModel.ItemID })); } return(View(viewModel)); }