I have a problem when starting a project with the given code
<h1>All cars</h1>
<h3>@Model.currCategory</h3>
<div class="row mt-5 mb-2">
@{
foreach (Car car in Model.allCars)
{
@Html.Partial("AllCars",car)
}
}
</div>
who knows what can help? add controller code
using Shop.Data.Models;
namespace Shop.ViewModels
{
public class CarsListViewModel
{
public IEnumerable<Car> allCars { get; set; }
public string currCategory { get; set; }
}
}
and code AllCars
@model Car
<div class="col-lg-4">
<img class="img-thumbnail" src="@Model.img" height="300" width="300" alt="@Model.Name" />
<h2>@Model.Name</h2>
<p>@Model.shortDesc</p>
<p>Ціна: @Model.price.ToString("c")</p>
<p><a class="btn btn-warning" href="#">More details</a></p>
</div>
I read a similar article, where the guy was recommended to add the .cshtml extension or the full path, it didn’t help me enter image description here
since you are using net core , you can try the new syntax
and make shore that you have AllCars.cshtml in a proper folder