Я новичок в MVC5.Я хотел отобразить список коллекции в представлении, которое я сделал.Но есть непредвиденное кодирование (System.Collections.Generic.List`1 ...) появляется в верхней части HTML, когда представление отображается.
Пожалуйста, просмотрите скриншот
Похоже, что это сделать @Model IEnumerableЯ объявил в верхней части зрения.Как мне от этого избавиться?
Вот исходный код:)
@Model IEnumerable<CompanyManagementSystem.ViewModels.UserViewModel>
@{
ViewBag.Title = "User Management";
}
@section Link {
<link href="~/vendor/datatables/dataTables.bootstrap4.min.css" rel="stylesheet" />
}
<h1 class="h3 mb-2 text-gray-500">@ViewBag.Title</h1>
<div class="row">
<div class="col-lg-12">
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Users Listing</h6>
</div>
<div class="card-body">
@Html.ActionLink("Add New User", "New", "UserManagement", new { @class = "btn btn-primary" })
<br />
<br />
<div class="table-responsive">
<table id="users" class="table table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Edit</th>
<th>Delete</th>
<th>Name</th>
<th>Email</th>
<th>Mobile Number</th>
<th>Position</th>
<th>Active User</th>
</tr>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
@foreach(var user in Model)
{
<tr>
<td>
<a class="btn btn-success btn-sm btn-icon-split" href="@Url.Action("Edit", "UserManagement", new { Id = user.Id})">
<span class='icon text-white-50'>
<i class='fas fa-edit'></i>
</span>
<span class='text'>Edit</span>
</a>
</td>