Asp.net mvc 4 操纵模型,然后在视图中反映该模型

Asp.net mvc 4 操纵模型,然后在视图中反映该模型,asp.net-mvc-4,Asp.net Mvc 4,我有一个带有一个属性的LogoutModel。我想让我的家庭控制器更改此值,然后让视图显示此值,但它似乎不起作用。当显示注销视图时,它显示:“再见Html.LabelFor(m=>m.PreviouslyLoggedInUsername)” 注销模型: public class LogoutModel { public string PreviouslyLoggedInUsername { get; set; } } 家庭控制器:

我有一个带有一个属性的
LogoutModel
。我想让我的
家庭控制器
更改此值,然后让
视图
显示此值,但它似乎不起作用。当显示注销视图时,它显示:“再见Html.LabelFor(m=>m.PreviouslyLoggedInUsername)”

注销模型:

public class LogoutModel
        {
            public string PreviouslyLoggedInUsername { get; set; }
        }
家庭控制器:

        public ActionResult Logout(HomeModels.LogoutModel model)
        {
            model.PreviouslyLoggedInUsername = previousLoggedIn;
            return View(model);
        }
视图:

@使用电子商务。模型
@model HomeModels.LogoutModel
@{
ViewBag.Title=“注销”;
Layout=“~/Views/Shared/Master.cshtml”;
}
您已注销。
@使用(Html.BeginForm())
{
再见
LabelFor(m=>m.PreviouslyLoggedInUsername)

}

您需要在
Html.LabelFor…

<table>
    <tr>
        <td>
            <label>Goodbye </label>
            @Html.LabelFor(m => m.PreviouslyLoggedInUsername)
        </td>
    </tr>
</table>

再见
@LabelFor(m=>m.PreviouslyLoggedInUsername)

作为参考,这里有一个

,它以什么方式不起作用?它只是在注销视图上显示“再见Html.LabelFor(m=>m.PreviouslyLoggedInUsername)”,而不是实际的用户名。
<table>
    <tr>
        <td>
            <label>Goodbye </label>
            @Html.LabelFor(m => m.PreviouslyLoggedInUsername)
        </td>
    </tr>
</table>