public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { //Post and return to the page return(Page()); } // we need the resource group for updating the capacity later in the // create process and the pbi capacity api does not return a resource group var pbiCapacities = await _capacityService.ListAsync(); // The user will need to have access to the capacity in Azure and be a dedicated capacity admin var pbiCapacity = pbiCapacities.Where(x => x.Name == Workspace.CapacityName).SingleOrDefault(); if (pbiCapacity == null) { //Post and return to the page return(Page()); } //var resourceIdParts = Utils.ParseAzureResourceId(pbiCapacity.Id.ToString()); //var resourceGroup = resourceIdParts[4]; var request = new CreateWorkspaceRequest { CapacityId = pbiCapacity.CapacityId, Name = Workspace.Name }; var group = await _workspaceService.CreateAsync(request); Group = group; return(Page()); }
public async Task <ActionResult <Group> > Create(CreateWorkspaceRequest req) { var group = await _workspaceService.CreateAsync(req.Name); if (req.CapacityId != Guid.Empty) { await _workspaceService.AssignWorkspaceToCapacityAsync(group.Id, req.CapacityId); } return(group); }