locked
master detail model RRS feed

  • Question

  • User-2022605885 posted

    hi everyone,

    i wanna wrtite a model for master - detail tables. using mvc and entity framework.

    for example maste table is ORders, detail table is ORderDetails.

    ORders colunms (OrderID, Date, Employe..)

    ORders
    OrderID    Date               ....
    1               1/1/10
    2               1/2/10          


    OrderDetail columns (OrderID, porductID, Amount)

    ORderID       ProductID   Amount
    1                   1                 10
    1                    2                8
    1                   3                  7


    i am creating a model for this structure

    Puclis class Model{

    public OrderID, Date, Employe;
    List<OrderDetail> list ;  // this is another class OrderDetails...

    }


    while saving this model to database  orderID,Data,Employe...  items are saving Orders table in database. and List<OrderDetail> is saving with for loop to ORderDetail table.

    but editing  the order and details model is difficult.:(

    is there eny easy way?

    Tuesday, February 1, 2011 9:15 AM

Answers

  • User-1620313041 posted

    I suggest just display the Master, and then updating the detail by using an ajax call. You can put a detail link on each row of the master display. Pressing that link will trigger an ajax call that display all order detail items.

    In my opinion this is the most user friendly (and also simpler way) to do the job. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 4, 2011 5:50 AM

All replies

  • User197322208 posted

    http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx

    Tuesday, February 1, 2011 9:29 AM
  • User712082397 posted

    Would you please share code so that we can comment on where you can make improvements? 

    Tuesday, February 1, 2011 1:57 PM
  • User-1210061641 posted

    Hi,

    I suggest you render the editing order and details view seperately. User can click each order-detial in the list to go to the OrderDetail view and edit.

     

    Hope this helpful,

    Forest Cheng

    Friday, February 4, 2011 1:36 AM
  • User-1620313041 posted

    I suggest just display the Master, and then updating the detail by using an ajax call. You can put a detail link on each row of the master display. Pressing that link will trigger an ajax call that display all order detail items.

    In my opinion this is the most user friendly (and also simpler way) to do the job. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 4, 2011 5:50 AM