Entity framework 我想添加动态文本框

Entity framework 我想添加动态文本框,entity-framework,model-view-controller,c#-4.0,code-first,Entity Framework,Model View Controller,C# 4.0,Code First,我的程序有问题。我有三个DB模型,酒店类别,酒店房间类型和价格。在某些类别中有两种,但在另一些类别中有三种。我们需要为每个类别的每个房间制作文本框。在那之后,我必须像这样发布:分类,房间,价格。有了for循环,我就不明白了。如何将这些类别与arrayList中的每个类别关联起来 public class PrPrice { public string Name { get; set; } public int[] Program

我的程序有问题。我有三个DB模型,酒店类别,酒店房间类型和价格。在某些类别中有两种,但在另一些类别中有三种。我们需要为每个类别的每个房间制作文本框。在那之后,我必须像这样发布:分类,房间,价格。有了for循环,我就不明白了。如何将这些类别与arrayList中的每个类别关联起来

  public class PrPrice
        {
            public string Name { get; set; }
            public int[] ProgramID { get; set; }
            public List<HotelRoomProgram> hotelRoomProgram { get; set; }
            public int[] hotelRoomProgramID { get; set; }
            public List<HotelCategoryProgram> hotelCategoryPrograms { get; set; }
            public int[] hotelCategoryProgramsID { get; set; }
            public decimal[] Price { get; set; }



        }
公共类价格
{
公共字符串名称{get;set;}
public int[]程序ID{get;set;}
公共列表hotelRoomProgram{get;set;}
public int[]hotelRoomProgramID{get;set;}
公共列表HotelCategoryProgramms{get;set;}
public int[]HotelCategoryProgrammsid{get;set;}
公共十进制[]价格{get;set;}
}

for(int i=0;ix.hotelCategoryPrograms[i].HotelCategories.ID)
@Model.hotelcategorityprograms[i].HotelCategories.Name
对于(int a=0;ax.hotelRoomProgram[a].HotelRoomType.ID)
@Model.hotelRoomProgram[a].HotelRoomType.Name
@TextBoxFor(x=>x.Price[a],新的{id=a})
}
  for (int i = 0; i < Model.hotelCategoryPrograms.Count(); i++)
                                        {
                                            @Html.HiddenFor(x=>x.hotelCategoryPrograms[i].HotelCategories.ID)
                                            <label>@Model.hotelCategoryPrograms[i].HotelCategories.Name</label>
                                            for (int a =0; a < Model.hotelRoomProgram.Count(); a++)
                                            {
                                               @Html.HiddenFor(x=> x.hotelRoomProgram[a].HotelRoomType.ID)
                                                <label>@Model.hotelRoomProgram[a].HotelRoomType.Name</label>
                                                @Html.TextBoxFor(x => x.Price[a], new {id =a })
                                            }