我的程序有问题。我有三个数据库模型,hotelcategory,hotelroom类型和价格。在某些类别中,有两个类别,而在另一些类别中,则有三个类别。我们需要为每个类别中的每个房间创建文本框。之后,我必须像这样发布它:categoryID,roomİD,price。与循环我没有得到它。我如何将这些类别与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; }
}
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 })
}