private static void Get(UserSecurityContext user, HttpContext context, CancellationToken cancel) { try { TaxaUnitTypeProviderBase provider = TaxonomyManager.Instance.GetTaxaUnitTypeProvider(user); if (provider != null) { IEnumerable <TaxaUnitType> unitTypes = provider.Get(); JArray junittypes = Jsonifier.ToJson(unitTypes); if (junittypes != null) { RestUtils.Push(context.Response, JsonOpStatus.Ok, junittypes.ToString()); } else { RestUtils.Push(context.Response, JsonOpStatus.Ok, "[]"); } return; } RestUtils.Push(context.Response, JsonOpStatus.Failed); } catch { RestUtils.Push(context.Response, JsonOpStatus.Failed); return; } }
static void RetrieveTaxaUnitType(UserSecurityContext context, string name) { TaxaUnitTypeProviderBase prov = TaxonomyManager.Instance.GetTaxaUnitTypeProvider(context); var taxaUnitType = prov.Get(name); foreach (var taxa in taxaUnitType) { Console.WriteLine("TaxaUnitType: " + taxa.Name + ", " + taxa.Identity.Identity); } Console.WriteLine("Retrieve TaxaUnitType Successful!"); }