Edit problem on asp.net mvc
- by ognjenb
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<MvcKVteam.Models.transporter>>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Transporters
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Transporters</h2>
<table class="data-table" id="">
<tr>
<th>
Id
</th>
<th>
ContactId
</th>
<th>
Name
</th>
<th>
Notes
</th>
<th>
PreferredCurrency
</th>
<th>
PriceList
</th>
<th>
SeviceTypeAvailible
</th>
<th>
Contact
</th>
</tr>
<% foreach (var item in Model) { %>
<tr>
<td>
<%= Html.Encode(item.Id) %>
</td>
<td>
<%= Html.Encode(item.ContactId) %>
</td>
<td>
<%= Html.Encode(item.Name) %>
</td>
<td>
<%= Html.Encode(item.Notes) %>
</td>
<td>
<%= Html.Encode(item.PreferredCurrency) %>
</td>
<td>
<%= Html.Encode(item.PriceList) %>
</td>
<td>
<%= Html.Encode(item.SeviceTypeAvailible) %>
</td>
<td>
<%= Html.ActionLink("View contact info", "Edit", new { id = item.ContactId }) %>
</td>
</tr>
<% } %>
</table>
<p>
<%= Html.ActionLink("Create New", "Create") %>
</p>
This action for Edit:
public ActionResult Edit(int id)
{
var FilesQuery1 = from i in FilesEntities.contact
where i.Id == id
select i;
return View(FilesQuery1);
}
When click on "View contact info" link I have this error: The model item passed into the dictionary is of type 'System.Data.Objects.ObjectQuery`1[MvcKVteam.Models.contact]', but this dictionary requires a model item of type 'MvcKVteam.Models.contact'.