In our Winui3 application, we are following MVVM architecture. I have InvoiceData, InvoiceModel, InvoiceViewModel and InvoiceService for my Invoice module. During Saving an Invoice from the ViewModel, I need to convert the InvoiceModel to InvoiceData to hit the API. Converting the Model to Data depends on a few other properties in the ViewModel. Let us say if the IsXFeatureEnabled/IsXFeatureVisible property in ViewModel is true, then I need to copy 5 properties in the Model to Data, else I will ignore it. I Cannot have those feature properties in the Model as it is Meta and needed for UI visibility.
In the above case, Can I have the Model to Data conversion in the ViewModel layer itself so that I can access all the needed properties directly and pass the resultant Data object to the InvoiceService, which will take care of the further API handling.
The reason for this query is that the MVVM sample project by Microsoft has those Conversion methods in the Service layer. (https://github.com/microsoft/InventorySample). Is Moving those methods to ViewModel against the architecture rules?