top of page
Search

Solucionario Ingenieria Economica Degarmo







Solucionario Ingenieria Economica Degarmo .Q: What is the correct pattern for when a controller method is 'in charge' of one or more related entities? This question is essentially about the correct pattern for when a controller method is 'in charge' of one or more related entities. I have a table of 'images'. Each image can be assigned to one of several document templates. Each document template can be assigned to one or more report templates. The action of saving the image is called from a view model: class ImageViewModel { public Image Image { get; set; } public List DocumentTemplates { get; set; } public List ReportTemplates { get; set; } // other properties... } The view model is bound to a view, which is where the user goes to enter the content of the various elements. public class ImageItemViewModel { public string Text { get; set; } public List DocumentTemplates { get; set; } public List ReportTemplates { get; set; } // other properties... } I need the user to be able to type in some text with the form, and to have it go to the database. At this point it would be easy, but what about adding an order item? { contextMenuTemplate "Order Item (New)", function OrderItemViewModel_OnAction() } { contextMenuTemplate "Order Item (Update)", function OrderItemViewModel_OnAction() } { contextMenuTemplate "Order Item (Delete)", function OrderItemViewModel_OnAction() } But the problem is that, depending on where the order item is relative to the other elements, it can either be part of the document template or the report template. In the case that it is a document template, the order item is basically an unrelated element that exists independent of the rest of the content. I don't want it to be part of the view model, because of course it needs to be made part of the controller somehow. It should be added to the document template. How do I actually achieve this? This is probably a fairly standard use case for MVC, but I just can't d0c515b9f4


Related links:

7 views0 comments
bottom of page