Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC 3 ViewModel Pattern issue (using RAZOR)
    primarykey
    data
    text
    <p>I've researched this issue and can not find a solution. My problem is that in my view, I can not view the properties of my ViewModel (e.g., Model.Supplier.SupplerName). Intellisense will only allow me to go Model.Suppliers, or Model.ToolTypes, or Model.ToolTypesSuppliers . I can not get the properties of each of these models that I included into the ViewModel.</p> <p><strong>ViewModel:</strong></p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace ToolOrder.Models { public class ToolTypeSupplierViewModel { public ToolTypeSupplierViewModel(IEnumerable&lt;ToolType&gt; tooltypes, IEnumerable&lt;Supplier&gt; suppliers, IEnumerable&lt;ToolTypeSupplier&gt; tooltypesuppliers) { this.ToolTypes = tooltypes; this.Suppliers = suppliers; this.ToolTypeSuppliers = tooltypesuppliers; } public IEnumerable&lt;ToolType&gt; ToolTypes { get; private set; } public IEnumerable&lt;Supplier&gt; Suppliers { get; private set; } public IEnumerable&lt;ToolTypeSupplier&gt; ToolTypeSuppliers { get; private set; } } } </code></pre> <p><strong>Controller:</strong></p> <pre><code>public ActionResult ListToolTypeSupplierOptions() { var _tooltypelist =_repository.FetchAllToolTypeOptions(); var _supplierlist = _repository.FetchAllSupplierOptions(); var _toolstypesupplierlist = _repository.FetchAllToolTypeSupplierOptions(); return View(new ToolTypeSupplierViewModel(_tooltypelist, _supplierlist, _toolstypesupplierlist)); } </code></pre> <p><strong>View:</strong></p> <pre><code>@model IEnumerable&lt;ToolOrder.Models.ToolTypeSupplierViewModel&gt; &lt;table&gt; &lt;tr&gt; &lt;th&gt;Supplier&lt;/th&gt; &lt;th&gt;Tool TYpe&lt;/th&gt; &lt;th&gt;Created&lt;/th&gt; &lt;th&gt;Last Modified &lt;/th&gt; &lt;/tr&gt; @foreach (var item in Model.) { &lt;tr&gt; &lt;td&gt; &lt;/td&gt; &lt;/tr&gt; } &lt;/table&gt; </code></pre> <p>Any help would be appreciated or if any further clarification is required, I can follow up. I apologize if this is somewhat vague, I've been up trying to figure out why I can not pull the the properties of each Model that I've included in my ViewModel. Thank you in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload