Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8c6126f

Browse files
Created user registration form
1 parent 5de58a3 commit 8c6126f

File tree

7 files changed

+130
-4
lines changed

7 files changed

+130
-4
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Microsoft.AspNetCore.Mvc;
6+
using Webgentle.BookStore.Models;
7+
8+
namespace Webgentle.BookStore.Controllers
9+
{
10+
public class AccountController : Controller
11+
{
12+
[Route("signup")]
13+
public IActionResult Signup()
14+
{
15+
return View();
16+
}
17+
18+
[Route("signup")]
19+
[HttpPost]
20+
public IActionResult Signup(SignUpUserModel userModel)
21+
{
22+
if (ModelState.IsValid)
23+
{
24+
// write your code
25+
26+
ModelState.Clear();
27+
}
28+
return View();
29+
}
30+
}
31+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel.DataAnnotations;
4+
using System.Linq;
5+
using System.Threading.Tasks;
6+
7+
namespace Webgentle.BookStore.Models
8+
{
9+
public class SignUpUserModel
10+
{
11+
[Required(ErrorMessage = "Please enter your email")]
12+
[Display(Name = "Email address")]
13+
[EmailAddress(ErrorMessage ="Please enter a valid email")]
14+
public string Email { get; set; }
15+
16+
[Required(ErrorMessage = "Please enter a strong password")]
17+
[Compare("ConfirmPassword", ErrorMessage ="Password does not match")]
18+
[Display(Name ="Password")]
19+
[DataType(DataType.Password)]
20+
public string Password { get; set; }
21+
22+
[Required(ErrorMessage = "Please confirm your password")]
23+
[Display(Name = "Confirm Password")]
24+
[DataType(DataType.Password)]
25+
public string ConfirmPassword { get; set; }
26+
}
27+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
@model Webgentle.BookStore.Models.SignUpUserModel
2+
3+
@{
4+
Layout = null;
5+
}
6+
7+
<!DOCTYPE html>
8+
9+
<html>
10+
<head>
11+
<meta name="viewport" content="width=device-width" />
12+
<title>Signup</title>
13+
<environment include="Development">
14+
<link href="~/lib/twitter-bootstrap/css/bootstrap.css" rel="stylesheet" />
15+
</environment>
16+
<environment exclude="Development">
17+
@*<link href="~/lib/twitter-bootstrap/css/bootstrap.min.css" rel="stylesheet" />*@
18+
19+
<link rel="stylesheet"
20+
href="http://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
21+
asp-fallback-href="~/lib/twitter-bootstrap/css/bootstrap.min.css"
22+
asp-fallback-test-class="sr-only"
23+
asp-fallback-test-property="position"
24+
asp-fallback-test-value="absolute"
25+
integrity=""
26+
crossorigin="anonymous">
27+
</environment>
28+
</head>
29+
<body>
30+
<div class="container">
31+
32+
<h4>Sign up</h4>
33+
<hr />
34+
<div class="row">
35+
<div class="col-md-4">
36+
<form asp-action="Signup">
37+
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
38+
<div class="form-group">
39+
<label asp-for="Email" class="control-label"></label>
40+
<input asp-for="Email" class="form-control" />
41+
<span asp-validation-for="Email" class="text-danger"></span>
42+
</div>
43+
<div class="form-group">
44+
<label asp-for="Password" class="control-label"></label>
45+
<input asp-for="Password" class="form-control" />
46+
<span asp-validation-for="Password" class="text-danger"></span>
47+
</div>
48+
<div class="form-group">
49+
<label asp-for="ConfirmPassword" class="control-label"></label>
50+
<input asp-for="ConfirmPassword" class="form-control" />
51+
<span asp-validation-for="ConfirmPassword" class="text-danger"></span>
52+
</div>
53+
<div class="form-group">
54+
<input type="submit" value="Create" class="btn btn-primary" />
55+
</div>
56+
</form>
57+
</div>
58+
<div class="col-md-8">
59+
<img src="~/images/signup.png" class="img-fluid" />
60+
</div>
61+
</div>
62+
63+
<div>
64+
<a asp-action="Index">Back to List</a>
65+
</div>
66+
67+
</div>
68+
</body>
69+
</html>

‎Webgentle.BookStore/Webgentle.BookStore/Webgentle.BookStore.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<PrivateAssets>all</PrivateAssets>
1717
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1818
</PackageReference>
19-
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.2" />
19+
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" />
2020
</ItemGroup>
2121

2222
<ItemGroup>

‎Webgentle.BookStore/Webgentle.BookStore/Webgentle.BookStore.csproj.user‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@
88
<Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
99
<Controller_SelectedScaffolderCategoryPath>root/Controller</Controller_SelectedScaffolderCategoryPath>
1010
<WebStackScaffolding_ControllerDialogWidth>600</WebStackScaffolding_ControllerDialogWidth>
11-
<WebStackScaffolding_IsLayoutPageSelected>True</WebStackScaffolding_IsLayoutPageSelected>
11+
<WebStackScaffolding_IsLayoutPageSelected>False</WebStackScaffolding_IsLayoutPageSelected>
1212
<WebStackScaffolding_IsPartialViewSelected>False</WebStackScaffolding_IsPartialViewSelected>
1313
<WebStackScaffolding_IsReferencingScriptLibrariesSelected>False</WebStackScaffolding_IsReferencingScriptLibrariesSelected>
1414
<WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected>
1515
<WebStackScaffolding_ViewDialogWidth>600</WebStackScaffolding_ViewDialogWidth>
16-
<WebStackScaffolding_LayoutPageFile>~/Views/Shared/_Layout.cshtml</WebStackScaffolding_LayoutPageFile>
1716
<ShowAllFiles>false</ShowAllFiles>
18-
<View_SelectedScaffolderID>RazorViewEmptyScaffolder</View_SelectedScaffolderID>
17+
<View_SelectedScaffolderID>RazorViewScaffolder</View_SelectedScaffolderID>
1918
<View_SelectedScaffolderCategoryPath>root/View</View_SelectedScaffolderCategoryPath>
2019
</PropertyGroup>
2120
</Project>
23.7 KB
Loading[フレーム]
24 KB
Loading[フレーム]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /