I'm new to .NET, I usually develop in RAILS where this problem is quite simple. I want to create a One-to-Many relationship: a Deal has many Periods. I've implemented Deal and Period models this way:
Public MustInherit Class Deal
Public Property ID As Integer
<Display(name:="Código")> <Required> _
Public Property Code As String
<Display(name:="Fecha")> <Required> _
Public Property DealDate As Date
<Display(name:="Periodos")> <Required> _
Public Overridable Property Periods() As ICollection(Of Period)
End Class
Public Class Period
Public Property ID As Integer
<Display(name:="Fecha")> <Required> _
Public Property PeriodDate As Date
<Display(name:="Volumen")> <Required> _
Public Property Volume As Double
<Display(name:="Operación")> <Required> _
Public Overridable Property Deal As Deal
End Class
Most difficult thing is I need to create Period objects inside the Deal form, dinamically. Any Deal can have a variable number of Periods, and periods should be added/removed from the Deal form. Here is an example image taken from the same app, coded in RAILS, that shows how it should be:
I haven't any clue in how to achieve this. Any Tutorial/Help/Clue will be appreciated. Thanks in advance.