質問編集履歴
2
補足情報修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -234,4 +234,4 @@
|
|
234
234
|
|
235
235
|
visualstudio 2022
|
236
236
|
|
237
|
-
.NET Framework
|
237
|
+
.NET Framework4.8
|
1
ASP.NET のタグ付、作成物、開発環境
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
###実現したいこと
|
2
2
|
|
3
|
+
現在、簡単な保存機能とログイン機能を備えたウェブサイトをMVCで作成しようとしております。
|
4
|
+
|
3
5
|
ブラウザから入力した値(現在はID/パスワード)を受け取ってSQLに保存したいと考えております
|
4
6
|
|
5
7
|
###前提
|
@@ -24,6 +26,8 @@
|
|
24
26
|
|
25
27
|
```C#
|
26
28
|
|
29
|
+
"Controller"
|
30
|
+
|
27
31
|
[HttpPost]
|
28
32
|
|
29
33
|
public void Add([Bind(Include = "a_id,a_pass,b_id,b_pass,c_id,c_pass")] Memo memo)
|
@@ -70,10 +74,164 @@
|
|
70
74
|
|
71
75
|
```
|
72
76
|
|
77
|
+
```cshtml
|
78
|
+
|
79
|
+
"View"
|
80
|
+
|
81
|
+
@{
|
82
|
+
|
83
|
+
ViewBag.Title = "登録";
|
84
|
+
|
85
|
+
var errorMessageList = ViewBag.errorMessageList;
|
86
|
+
|
87
|
+
}
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
<form action="/Memo/Add" method="post">
|
92
|
+
|
93
|
+
<table class="table">
|
94
|
+
|
95
|
+
<tr>
|
96
|
+
|
97
|
+
<th>A</th>
|
98
|
+
|
99
|
+
<td><b>ID : </b><input type="text" name="a_id" size="25" placeholder="a_IDを入力してください"></td>
|
100
|
+
|
101
|
+
<td><b>パスワード : </b><input type="password" size="35" name="a_pass" placeholder="aのパスワードを入力してください"></td>
|
102
|
+
|
103
|
+
</tr>
|
104
|
+
|
105
|
+
<tr>
|
106
|
+
|
107
|
+
<th>B</th>
|
108
|
+
|
109
|
+
<td><b>ID : </b><input type="text" size="25" name="b_id" placeholder="b_IDを入力してください"></td>
|
110
|
+
|
111
|
+
<td><b>パスワード : </b><input type="password" size="35" name="b_pass" placeholder="bのパスワードを入力してください"></td>
|
112
|
+
|
113
|
+
</tr>
|
114
|
+
|
115
|
+
<tr>
|
116
|
+
|
117
|
+
<th>C</th>
|
118
|
+
|
119
|
+
<td><b>ID : </b><input type="text" name="c_id" size="25" placeholder="c_IDを入力してください"></td>
|
120
|
+
|
121
|
+
<td><b>パスワード : </b><input type="password" size="35" name="c_pass" placeholder="cのパスワードを入力してください"></td>
|
122
|
+
|
123
|
+
</tr>
|
124
|
+
|
125
|
+
</table>
|
126
|
+
|
127
|
+
<br>
|
128
|
+
|
129
|
+
```
|
130
|
+
|
131
|
+
```C#
|
132
|
+
|
133
|
+
"Model"
|
134
|
+
|
135
|
+
using System;
|
136
|
+
|
137
|
+
using System.Collections.Generic;
|
138
|
+
|
139
|
+
using System.Linq;
|
140
|
+
|
141
|
+
using System.Web;
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
namespace MemoApp.Models
|
146
|
+
|
147
|
+
{
|
148
|
+
|
149
|
+
public class Memo
|
150
|
+
|
151
|
+
{
|
152
|
+
|
153
|
+
private int? linkagePrimaryKey;
|
154
|
+
|
155
|
+
private string a_Id;
|
156
|
+
|
157
|
+
private string a_Pass;
|
158
|
+
|
159
|
+
private string b_Id;
|
160
|
+
|
161
|
+
private string b_Pass;
|
162
|
+
|
163
|
+
private string c_Id;
|
164
|
+
|
165
|
+
private string c_Pass;
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
public Memo() { }
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
public Memo(int? linkagePrimaryKey, string a_Id, string a_ePass, string b_Id, string b_Pass, string c_Id, string c_Pass)
|
174
|
+
|
175
|
+
{
|
176
|
+
|
177
|
+
this.linkagePrimaryKey = linkagePrimaryKey;
|
178
|
+
|
179
|
+
this.googleId = a_Id;
|
180
|
+
|
181
|
+
this.googlePass = a_Pass;
|
182
|
+
|
183
|
+
this.tabelogId = b_Id;
|
184
|
+
|
185
|
+
this.tabelogPass = b_Pass;
|
186
|
+
|
187
|
+
this.gnaviId = c_Id;
|
188
|
+
|
189
|
+
this.gnaviPass = c_Pass;
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
}
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
public int? LinkagePrimaryKey { get => linkagePrimaryKey; set => linkagePrimaryKey = value; }
|
198
|
+
|
199
|
+
public string A_Id { get => a_Id; set => a_Id = value; }
|
200
|
+
|
201
|
+
public string A_Pass { get => a_Pass; set => a_Pass = value; }
|
202
|
+
|
203
|
+
public string B_Id { get => b_Id; set => b_Id = value; }
|
204
|
+
|
205
|
+
public string B_Pass { get => b_Pass; set => b_Pass = value; }
|
206
|
+
|
207
|
+
public string C_Id { get => c_Id; set => c_Id = value; }
|
208
|
+
|
209
|
+
public string C_Pass { get => c_Pass; set => c_Pass = value; }
|
210
|
+
|
211
|
+
}
|
212
|
+
|
213
|
+
}
|
214
|
+
|
215
|
+
```
|
216
|
+
|
217
|
+
<input type="submit" value=" 保存 " onclick="return confirm('入力内容はお間違いないですか?')" class="btn btn-success center-block text-right" ;>
|
218
|
+
|
219
|
+
<a href="/Memo/List">戻る</a>
|
220
|
+
|
221
|
+
</form>
|
222
|
+
|
223
|
+
```
|
224
|
+
|
225
|
+
|
226
|
+
|
73
227
|
|
74
228
|
|
75
229
|
### 補足情報(FW/ツールのバージョンなど)
|
76
230
|
|
77
|
-
|
231
|
+
開発環境
|
232
|
+
|
233
|
+
windows10 home
|
78
234
|
|
79
235
|
visualstudio 2022
|
236
|
+
|
237
|
+
.NET Framework6.0
|