public ActionResult DeleteConfirmed(string tenantId, ServicePrincipalModel editedServicePrincipalList)
        {
            // Delete all rows for this servicePrincipal list, that is,
            // Subscriber rows as well as ServicePrincipal rows.
            // Therefore, no need to specify row key.
            var listRows       = ServicePrincipalModel.GetAllFromStorage(tenantId);
            var batchOperation = new TableBatchOperation();
            int itemsInBatch   = 0;

            foreach (DynamicTableEntity listRow in listRows)
            {
                batchOperation.Delete(listRow);
                itemsInBatch++;
                if (itemsInBatch == 100)
                {
                    StorageFactory.Instance.IpcAzureAppTenantStateTable.ExecuteBatch(batchOperation);
                    itemsInBatch   = 0;
                    batchOperation = new TableBatchOperation();
                }
            }
            if (itemsInBatch > 0)
            {
                StorageFactory.Instance.IpcAzureAppTenantStateTable.ExecuteBatch(batchOperation);
            }
            return(RedirectToAction("Index"));
        }
 // GET: /ServicePrincipal/
 public ActionResult Index()
 {
     try
     {
         IEnumerable <ServicePrincipalModel> servicePrincipals = ServicePrincipalModel.GetAllFromStorage();
         return(View(servicePrincipals));
     }
     catch (StorageException se)
     {
         ViewBag.errorMessage = "Timeout error, try again. ";
         Trace.TraceError(se.Message);
         return(View("Error"));
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Default get request
 /// </summary>
 /// <returns>Action Result</returns>
 public ActionResult Index()
 {
     try
     {
         TemplatePublisherModel templatePublisherModel         = new TemplatePublisherModel();
         IEnumerable <ServicePrincipalModel> servicePrincipals = ServicePrincipalModel.GetAllFromStorage();
         if (servicePrincipals == null || servicePrincipals.Count <ServicePrincipalModel>() == 0)
         {
             return(RedirectToAction("Index", "ServicePrincipal"));
         }
         else
         {
             templatePublisherModel.ServicePrincipals = servicePrincipals;
             return(View(templatePublisherModel));
         }
     }
     catch (StorageException se)
     {
         ViewBag.errorMessage = "Timeout error, try again. ";
         Trace.TraceError(se.Message);
         return(View("Error"));
     }
 }