Asp.net Razor HTML页面声明@model-<&书信电报;名称空间>&燃气轮机;是在给定上下文中无效的类型

Asp.net Razor HTML页面声明@model-<&书信电报;名称空间>&燃气轮机;是在给定上下文中无效的类型,asp.net,razor,Asp.net,Razor,在我的HTML页面中,我发现了一个问题,我在这里声明了我的模型。表示名称App.Web.ViewModel.DisputeModel在给定上下文中无效。我对.NET有点陌生,所以我不确定问题出在哪里 我的HTML页面: @model App.Web.ViewModel.DisputeModel; //here is where I'm getting the error message <div class="row"> <div>

在我的HTML页面中,我发现了一个问题,我在这里声明了我的模型。表示名称
App.Web.ViewModel.DisputeModel
在给定上下文中无效。我对.NET有点陌生,所以我不确定问题出在哪里

我的HTML页面:

@model App.Web.ViewModel.DisputeModel; //here is where I'm getting the error message

<div class="row">
    <div>
        <div>
            <div id="response-alert"></div>
            @using (Html.BeginForm("Dispute", "Dispute", new AjaxOptions
            {
                HttpMethod = "POST",
                UpdateTargetId = "response-alert",
            }))
            {
                @Html.AntiForgeryToken()
                <div id="dispute-form-section">
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="form-group">
                                <label for="name">Name</label>
                                @Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } })
                                @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" })
                            </div>
                        </div>
                        <div class="col-sm-6">
                            <div class="form-group">
                                <label for="email">Email</label>
                                @Html.EditorFor(model => model.Email, new { htmlAttributes = new { @class = "form-control" } })
                                @Html.ValidationMessageFor(model => model.Email, "", new { @class = "text-danger" })
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="form-group">
                                <label for="num">Last Four Digits</label>
                                <span class="form-control">XXXX XXXX XXXX @Html.DisplayFor(model => model.LastFourDigits)</span>
                            </div>
                        </div>
                        <div class="col-sm-6">
                            <div class="form-group">
                                <label for="phone">Phone Number</label>
                                @Html.EditorFor(model => model.Phone, new { htmlAttributes = new { @class = "form-control" } })
                                @Html.ValidationMessageFor(model => model.Phone, "", new { @class = "text-danger" })
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label for="regarding">Description</label>
                                @Html.TextAreaFor(model => model.Description, new { htmlAttributes = new { @class = "form-control" } })
                                @Html.ValidationMessageFor(model => model.Description, "", new { @class = "text-danger" })
                            </div>
                        </div>
                    </div>
                </div>
                <button type="submit" id="dispute-submit-button">Submit</button>
            }
        </div>
    </div>
</div>

和我的控制器:

namespace App.Web.Controllers
{
    public class DisputeController : Controller
    {
        private readonly Client _client;

        public DisputeController()
        {
            _client = new Client(Clients.ServiceClient);
        }

        public ActionResult Dispute()
        {
            DisputeModel dispute = new DisputeModel();

            return View("Dispute", dispute);
        }

        [HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<ActionResult> Dispute(DisputeModel dispute)
        {
            if (!ModelState.IsValid)
                return View("Dispute", dispute);

            var response = await _client.PostAsync($"/dispute", dispute);
            // code to handle response

            return View("Dispute", dispute);
        }
    }
}
namespace App.Web.Controllers
{
公共类DisputController:控制器
{
私有只读客户端_客户端;
公共DisputeController()
{
_客户端=新客户端(Clients.ServiceClient);
}
公共诉讼结果争议()
{
DisputeModel争端=新建DisputeModel();
返回视图(“争议”,争议);
}
[HttpPost]
[ValidateAntiForgeryToken]
公共异步任务争议(争议模型争议)
{
如果(!ModelState.IsValid)
返回视图(“争议”,争议);
var response=wait_client.PostAsync($“/争议”,争议);
//处理响应的代码
返回视图(“争议”,争议);
}
}
}
更新:

在html页面中声明模型时,我需要删除分号

namespace App.Web.Controllers
{
    public class DisputeController : Controller
    {
        private readonly Client _client;

        public DisputeController()
        {
            _client = new Client(Clients.ServiceClient);
        }

        public ActionResult Dispute()
        {
            DisputeModel dispute = new DisputeModel();

            return View("Dispute", dispute);
        }

        [HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<ActionResult> Dispute(DisputeModel dispute)
        {
            if (!ModelState.IsValid)
                return View("Dispute", dispute);

            var response = await _client.PostAsync($"/dispute", dispute);
            // code to handle response

            return View("Dispute", dispute);
        }
    }
}