MVC:cshtml intellisense中缺少模型

时间:2015-05-19 20:26:31

标签: c# asp.net-mvc asp.net-mvc-4 razor

我正在.net中做一些示例MVC项目。出于某种原因,我的visual studio intellisense中缺少Model。我不知道我在这里错过了什么。请帮我看看原因。

控制器:

public class EmployeeController : Controller
{
    PersonalDetails personalDetails;

    public EmployeeController()
    {
        personalDetails = new PersonalDetails();
    }

    public ActionResult Employee()
    {
        return View("Employee", personalDetails.Employee(1));
    }
}

型号:

public class Employee
{
    public int ID { get; set; }
    public Nullable<int> EmployeeID { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
}

查看:

@model EmployeeModel.Employee 

@{
    ViewBag.Title = "Employee";
}

<select id="name">
@foreach (var item in Model.ID)//Model is not coming here.
{
    <option value="value">@item</option>
}

Model

0 个答案:

没有答案