In this question, I am looking for links / code for processing IList<OrderLine>in the form of editing MVC 2. In particular, I am interested in sending a full order to the client, and then the edited order is sent back to the object (for saving) using:
Html.EditorFor (m => m .orderlines [i]) (where the line order is an enumerated object)
Editing an order having several order lines (two tables, order and order, one for many) seems to be complicated. Are there any links / examples / templates to tell how to create this form that edits the entity and related objects in one form (in C # MVC 2)?
IList really throws me for a loop. Should I have it there (having another form for editing one order)? How could you use the server side of the factory to create an empty OrderLine in the form without sending the entire form back to the server? I hope that we will not process individual order lines with separate save, delete, etc. buttons. (For example, they can open an order, delete all rows, and then cancel, which should not have changed the order in either the repository or the database.
Class examples:
public class ViewModel {
public Order order {get;set;}
}
public class Order {
public int ID {get;set;}
public string name {get;set;}
public IList<OrderLine> orderlines {get;set;}
}
public class OrderLine {
public int orderID {get;set;}
public int orderLineID {get;set;}
public Product refProduct {get;set;}
public int quantity {get;set;}
public double price {get;set;}
}
source
share