I have created a view that accepts a ProjectsCreatorsVM class. This class has been structured this way:
public class ProjectsCreatorsVM
{
public List<ProjectVM> ProjectsCreators { get; set; }
public ProjectsCreatorsVM(List<ProjectVM> projectsCreators)
{
ProjectsCreators = projectsCreators;
}
}
In addition, the ProjectVM follow this structure:
public class ProjectVM
{
public Project Project { get; set; }
public ApplicationUser ApplicationUser { get; set; }
public ProjectVM(Project pro, ApplicationUser applUser)
{
Project = pro;
ApplicationUser = applUser;
}
}
Lastly, my view tries to go through the ProjectsCreators.Project but it does not seem to be possible.
<div class="card-content-container" >
@foreach (Project obj in @Model.ProjectsCreators.)
{
<div class="card">
<img class="card-img-top" src="@obj.ImgURL" alt ="project image" >
<div class="card-body d-flex flex-column">
<h5 class="card-title">@obj.Title</h5>
<h6 class="card-title">@obj.Title</h6>
<p class="card-text">
@obj.TruncatedDescription
</p>
<div class="mt-auto" style="display: flex; justify-content: space-between; align-items: center;">
<a href="/Customer/ProjectVisitor/ViewProjectDetail?id=@obj.Id" class="btn btn-primary">View Details</a>
</div>
</div>
</div>
I would appreciate any help. Thanks in advance.