私のASP.NET MVCアプリケーションに問題があります。以前に作成した既存のオブジェクトを別のActionResult
に変更するにはどうすればよいですか? 「ASP.NETの既存のオブジェクトを変更する
public ActionResult getLogin(AccountViewModel accountViewModel)
{
Account account2 = de.Accounts.FirstOrDefault(a => a.Username == accountViewModel.Account.Username);
PasswordReminder.PasswordReminder reminder = new PasswordReminder.PasswordReminder();
reminder.showQuestion(account2.Username);
return View("Question", reminder);
}
そして私は、属性にこののActionResult私の見る「回答」でそう
@model PasswordReminder.PasswordReminder
@{
Layout = null;
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Question</title>
</head>
<body>
<div>
@Model.questionReminder
@using (Html.BeginForm("Answer", "Account", FormMethod.Post))
{
@Html.TextBoxFor(a => a.reminderAnswer)
<input type="submit" value="Send" />
}
</div>
</body>
</html>
することにより、既存のリマインダーオブジェクトに属性を追加する:
私はこのアクションでオブジェクトを作成しましたreminderAnswer "私は値を入力しましたが、questionReminderはnullなので、これは新しいオブジェクトでなければなりません..すべてのおかげで、