C# InvalidOperationException:找不到类型“System.Collections.Generic.IEnumerable”的合适构造函数

C# InvalidOperationException:找不到类型“System.Collections.Generic.IEnumerable”的合适构造函数,c#,asp.net,visual-studio,razor,C#,Asp.net,Visual Studio,Razor,我正试图做到这一点,但与我的模型从Azure。 代码中没有错误,但索引无法运行。 在编写之前-是的,我已经使用System.Collections.Generic;用密码 我能用它做什么 编辑,在这里编码。这几乎和示例中的一样 视图类 using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace WebApka.Models { p

我正试图做到这一点,但与我的模型从Azure。

代码中没有错误,但索引无法运行。 在编写之前-是的,我已经使用System.Collections.Generic;用密码

我能用它做什么

编辑,在这里编码。这几乎和示例中的一样

视图类

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;


namespace WebApka.Models
{
    public class TestWidok
    {
        public Sesje sesjeyo { get; set; }
        public Pracownicy pracownicyyo { get; set; }
    }
}
控制器

using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace WebApka.Models
{
    public class HomeController : Controller
    {
        List<Sesje> sesje = new List<Sesje>();
        List<Pracownicy> pracownicy = new List<Pracownicy>();

        public ActionResult Index()
        {
            var TestWidok = from s in sesje
                            join st in pracownicy on s.SPId equals st.PId into st2
                            from st in st2.DefaultIfEmpty()
                            select new TestWidok { sesjeyo = s, pracownicyyo = st };
            return View(TestWidok);
        }
    }
}
看法


请显示您的代码您是如何将数据添加到sesje和pracownicy的?它们似乎都是空的。来自azure。应用程序可以显示表中的数据,但我需要连接表,所以现在我遇到了问题:/
@page
@model IEnumerable<WebApka.Models.TestWidok>
@{
    ViewData["Title"] = "Home page";
}

<table class="table table-striped">
    <tr>
        <td>1</td>
        <td>2</td>
        <td>3e</td>
        <td>4</td>
    </tr>
    @foreach (var item in Model)
    {
        <tr>
            <td>@item.sesjeyo.SDomena</td>
            <td>@item.sesjeyo.SUzytkownik</td>
            <td>@item.sesjeyo.SUwagi</td>
            <td>@item.pracownicyyo.PImieNazwisko</td>
        </tr>
    }
</table>