private async Task EmbedCustomerAndContactTelephonesAsync(ICaseRelated resource) { var telephoneQuery = new QuerySet(); telephoneQuery.Sort.Field = "order"; telephoneQuery.Sort.Order = SortQuery.ORDER_ASC; telephoneQuery.Include.Fields = new string[] { "country", "telephone-type" }; if (resource.Customer != null) { var customerIncludeQuery = new QuerySet(); customerIncludeQuery.Include.Fields = new string[] { "honorific-prefix", "language" }; resource.Customer = await _customerDataProvider.GetByNumberAsync(resource.Customer.Number, customerIncludeQuery); var telephones = await _telephoneDataProvider.GetAllByCustomerIdAsync(resource.Customer.Id, telephoneQuery); resource.Customer.Telephones = telephones.Items; } if (resource.Contact != null) { var contactIncludeQuery = new QuerySet(); contactIncludeQuery.Include.Fields = new string[] { "honorific-prefix", "language" }; resource.Contact = await _contactDataProvider.GetByIdAsync(resource.Contact.Id, contactIncludeQuery); var telephones = await _telephoneDataProvider.GetAllByContactIdAsync(resource.Contact.Id, telephoneQuery); resource.Contact.Telephones = telephones.Items; } }
private async Task EmbedBuildingAsync(ICaseRelated resource) { if (resource.Building != null) { var buildingIncludeQuery = new QuerySet(); buildingIncludeQuery.Include.Fields = new string[] { "honorific-prefix", "language" }; resource.Building = await _buildingDataProvider.GetByIdAsync(resource.Building.Id, buildingIncludeQuery); } }
private async Task EmbedCustomerAndContactAsync(ICaseRelated resource) { if (resource.Customer != null) { var customerIncludeQuery = new QuerySet(); customerIncludeQuery.Include.Fields = new string[] { "honorific-prefix", "language" }; resource.Customer = await _customerDataProvider.GetByNumberAsync(resource.Customer.Number, customerIncludeQuery); } if (resource.Contact != null) { var contactIncludeQuery = new QuerySet(); contactIncludeQuery.Include.Fields = new string[] { "honorific-prefix", "language" }; resource.Contact = await _contactDataProvider.GetByIdAsync(resource.Contact.Id, contactIncludeQuery); } }