添加视图

然后在文件夹/ Views / MacroPartials / Account 中创建一个视图

@model MyCMS.Models.Account.MemberLoginViewModel
@using MyCMS.Controllers.Account

@if (User.Identity.IsAuthenticated)
{
        <p>Logged in as: @User.Identity.Name</p>
        using (Html.BeginUmbracoForm<MemberLoginSurfaceController>("MemberLogout", FormMethod.Post, new { id = "logoutForm" }))
        {
            @Html.AntiForgeryToken()
         <button type="submit" class="btn btn-outline-secondary">Log out</button>
         }

}
else
{
    using (Html.BeginUmbracoForm<MemberLoginSurfaceController>("MemberLoginPost", "MemberLoginSurface", new { @class = "form-inline" }))
    {
        <div class="form-group">
            <label for="email">Email</label>
            <input name="Email" type="email" class="form-control" id="loginform_email" placeholder="name@email.no">
        </div>
                <div class="form-group">
                    <label for="password">Password</label>
                    <input name="Password" type="password" class="form-control" id="loginform_password" placeholder="*****">
                </div>
                <div class="form-check">
                    <label class="form-check-label">
                        <input name="RememberMe" class="form-check-input" type="checkbox">Husk meg
                    </label>
                </div>
                <button type="submit" class="btn btn-outline-secondary">Log in</button>

    }
    <p>@TempData["Status"]</p>
}