У меня есть следующая модель:
public class CitationViewModel
{
public long Id { get; set; }
public GeneralModel GeneralInfo { get; set; }
public List<TransportModel> Transport { get; set; }
public List<SelectItem> PricingList { get; set; }
}
В моей GeneralModel у меня есть:
public class GeneralModel
{
public long Id { get; set; }
public long? PricingMethod { get; set; }
}
И TransportModel:
public class TransportModel
{
public long ModeOfTransportId { get; set; }
public DocumentModel Document { get; set; }
}
В моем контроллере,Я делаю следующее:
public ActionResult Index(long leadID)
{
CitationViewModel citation = new CitationViewModel
{
GeneralInfo = setting the general info details.
};
citation.LeadId = leadID;
citation.PricingList = GetPricingList();
citation.Transport = GetModeOfTransport();
foreach (TransportModel trans in citation.Transport)
{
//Load Document Types
DocumentModel document = new DocumentModel();
trans.Document = document;
}
return View(citation);
}
На мой взгляд, я делаю цикл для TransportModel:
@for(var i = 0; i < Model.Transport.Count; i++)
{
<div class="custom-file">
@Html.Partial("../Shared/Partials/Documents/_UploadDocument", Model.Transport[i].Document)
</div>
<div class="mdl-textfield mdl-textfield--floating-label js-dropdown">
@Html.EJ().DropDownListFor(model => model.GeneralInfo.PricingMethod).Datasource(Model.PricingMethodList).DropDownListFields(Pricing => Pricing.Text("Value").Value("Key")).EnableFilterSearch(true).FilterType(SearchFilterType.Contains).PopupHeight("300px")
<label for="PricingMethod">PricingMethod</label>
</div>
}
Однако для каждого имеющегося транспорта я не получаюСписок цен и частичное представление для каждого из них.На самом деле для каждого имеющегося у меня транспорта у меня отображается вкладка, и на каждой вкладке мне нужно иметь раскрывающийся список для ценообразования, а для каждого нужно вызвать частичное представление UploadDocument.Результат, который я получаю прямо сейчас, состоит в том, что эти два свойства перепутаны.Есть идеи, что я могу делать не так?Спасибо