将数据绑定到列表 MVC 控制器中

Bind data into a list MVC controller

这是我的控制器。我有一个列表格式的视图,但它给出了错误:

Cannot implicitly convert type 'System.Collections.Generic.List' to 'MvcDemo.Models.Employee' G:\MvcApp\MvcDemo\MvcDemo\Controllers\EmployeeController.cs 18

    public ActionResult Details()
    {
        EmployeeContext ec = new EmployeeContext();
        Employee e1 = ec.employee.ToList();


        return View(e1);
    }

我该如何解决这个问题?

改成如下。

public ActionResult Details()
{
    EmployeeContext ec = new EmployeeContext();
    List<Employee> e1 = ec.employee.ToList();


    return View(e1);
}