Does anyone know of any mvc samples that implement a one to many editing situation in a single or multiple views?
For example I'm looking for something that would show how to best implement a simple relationship of Order to OrderItem where OrderItem contains a Product reference and a Quantity. Sample models would be as follows:
public class Order
{
public int OrderID { get;set;}
public string Name { get;set;}
public ICollection<OrderItem> OrderItems { get;set;}
}
public class Product
{
public int ProductID { get;set;}
public string Name { get;set;}
}
public class OrderItem
{
public int OrderItemID { get;set;}
public Product Product { get;set;}
public int Quantity { get;set;}
public Order Order { get;set;}
}
I've looked at a lot of the samples out there and they are for simple CRUD operations without any navigation properties etc. Also, if possible I'd love to figure out how to edit an existing Order, adding, removing, changing OrderItem's without persisting to the database until the Save action on the Order is run.