Exemple #1
0
        public static async Task Lesson(DataServiceRestClient client)
        {
            //A catalog must have at least one attribute.
            //Attributes with entity 'Catalog' must not be of type 'CatalogAttribute'
            await client.CreateAttributeDefinitions(EntityDto.Catalog, new[] { MachineName, MachineNumber, MachineVendor });

            //Create the catalog
            await client.CreateCatalogs(new[] { MachineCatalog });

            //Add an attribute
            MachineCatalog.ValidAttributes = MachineCatalog.ValidAttributes.Append(MachineVendor.Key);

            await client.UpdateCatalogs(new[] { MachineCatalog });

            //Add an entry
            await client.CreateCatalogEntries(MachineCatalog.Uuid, new[] { EntryXenos });

            //Update existing catalog entries
            EntryAccura.Attributes  = EntryAccura.Attributes.Append(new AttributeDto(MachineVendor.Key, "Zeiss"));
            EntryContura.Attributes = EntryContura.Attributes.Append(new AttributeDto(MachineVendor.Key, "Zeiss"));

            await client.UpdateCatalogs(new[] { MachineCatalog });
        }