I am working on an ASP.NET MVC application which has a model for a business, linked to another model (business trading hours) in a one-to-many relationship.
When creating this entity we have a form where we would like to provide a fixed set of the BusinessTradingHours entities, so I have used something like the following (kind of what I am used to with Rails):
<!-- for Monday -->
<select id="TradingHours[1][OpenHours]" name="TradingHours[1][OpenHours]"><option>06:00</option></select>
<select id="TradingHours[1][CloseHours]" name="TradingHours[1][CloseHours]"><option>06:00</option></select>
<input id="TradingHours[1][IsClosed]" name="TradingHours[1][IsClosed]" type="checkbox" value="true" />
<!-- for Tuesday -->
<select id="TradingHours[2][OpenHours]" name="TradingHours[2][OpenHours]"><option>06:00</option></select>
<select id="TradingHours[2][CloseHours]" name="TradingHours[2][CloseHours]"><option>06:00</option></select>
<input id="TradingHours[2][IsClosed]" name="TradingHours[2][IsClosed]" type="checkbox" value="true" />
From my experience in Rails (which I know is not the same...) I would kind of expect to be able to do something like var tradingHours = Request.Form["TradingHours"];
which would give me an Array, which I could then iterate over... is this possible?
Otherwise, how else would this be accomplished?