add user managment(edit/delete/logout) and session
This commit is contained in:
@ -1,26 +0,0 @@
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Login";
|
||||
}
|
||||
|
||||
<h2>Login</h2>
|
||||
|
||||
<form asp-action="Login" asp-controller="Account" method="post">
|
||||
<div asp-validation-summary="All"></div>
|
||||
<div class="form-group">
|
||||
<label
|
||||
asp-for="usename">username</label>
|
||||
<input asp-for="usename" class="form-control" required />
|
||||
<span asp-validation-for="usename" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="password">password</label>
|
||||
|
||||
<input asp-for="password"
|
||||
type="password" class="form-control" required />
|
||||
<span asp-validation-for="Password" class="text-danger"></span>
|
||||
</div>
|
||||
<br />
|
||||
<button type="submit" class="btn btn-primary">Login</button>
|
||||
|
||||
</form>
|
||||
@ -1,51 +0,0 @@
|
||||
@model WebApplication1.Models.user
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Register";
|
||||
}
|
||||
|
||||
<h2>Create a new user</h2>
|
||||
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="form-horizontal">
|
||||
<h4>user</h4>
|
||||
<hr />
|
||||
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.usename, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.usename, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.usename, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.password, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.password, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.password, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.displayname, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.displayname, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.displayname, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Create" class="btn btn-outline-dark" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div>
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</div>
|
||||
@ -20,9 +20,8 @@
|
||||
<li>@Html.ActionLink("Home", "Index", "Home", new { area = "" }, new { @class = "nav-link" })</li>
|
||||
<li>@Html.ActionLink("About", "About", "Home", new { area = "" }, new { @class = "nav-link" })</li>
|
||||
<li>@Html.ActionLink("Contact", "Contact", "Home", new { area = "" }, new { @class = "nav-link" })</li>
|
||||
<li>@Html.ActionLink("Login", "Login", "users", new { area = "" }, new { @class = "nav-link" })</li>
|
||||
<li>@Html.ActionLink("Register", "Register", "users", new { area = "" }, new { @class = "nav-link" })</li>
|
||||
|
||||
<li>@Html.ActionLink("user setting", "index", "users", new { area = "" }, new { @class = "nav-link" })</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -40,9 +40,11 @@
|
||||
@using (Html.BeginForm()) {
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="form-actions no-color">
|
||||
<input type="submit" value="Delete" class="btn btn-default" /> |
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</div>
|
||||
<div class="form-actions no-color">
|
||||
|
||||
@Html.ActionLink("back to account managment", "index", null, new { @class = "btn btn-outline-dark" })
|
||||
|
||||
<input type="submit" value="Delete" class="btn btn-outline-dark" />
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
@model WebApplication1.Models.user
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Details";
|
||||
}
|
||||
|
||||
<h2>Details</h2>
|
||||
|
||||
<div>
|
||||
<h4>user</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.usename)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.usename)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.password)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.password)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.displayname)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.displayname)
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
</div>
|
||||
<p>
|
||||
@Html.ActionLink("Edit", "Edit", new { id = Model.ID }) |
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</p>
|
||||
@ -1,15 +1,15 @@
|
||||
@model WebApplication1.Models.user
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Edit";
|
||||
ViewBag.Title = "Account managment";
|
||||
}
|
||||
|
||||
<h2>Edit</h2>
|
||||
<h2>Account managment</h2>
|
||||
<h4>View and Edit account details</h4>
|
||||
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
|
||||
<div class="form-horizontal">
|
||||
<h4>user</h4>
|
||||
<hr />
|
||||
@ -19,7 +19,7 @@
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.usename, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.usename, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.EditorFor(model => model.usename, new { htmlAttributes = new { @class = "form-control", @readonly = "readonly" } })
|
||||
@Html.ValidationMessageFor(model => model.usename, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
@ -39,15 +39,17 @@
|
||||
@Html.ValidationMessageFor(model => model.displayname, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Save" class="btn btn-default" />
|
||||
|
||||
@Html.ActionLink("back to account managment", "index", null, new { @class = "btn btn-outline-dark" })
|
||||
|
||||
<input type="submit" value="Save" class="btn btn-outline-dark" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div>
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</div>
|
||||
|
||||
@ -1,45 +1,53 @@
|
||||
@model IEnumerable<WebApplication1.Models.user>
|
||||
@model WebApplication1.Models.user
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
ViewBag.Title = "Account managment";
|
||||
}
|
||||
<h2>Account managment</h2>
|
||||
<h4>View and Edit account details</h4>
|
||||
|
||||
<h2>Index</h2>
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<p>
|
||||
@Html.ActionLink("Create New", "Create")
|
||||
</p>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>
|
||||
<div>
|
||||
<h4>user</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.usename)
|
||||
</th>
|
||||
<th>
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.usename)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.password)
|
||||
</th>
|
||||
<th>
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.password)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.displayname)
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</dt>
|
||||
|
||||
@foreach (var item in Model) {
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.usename)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.password)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.displayname)
|
||||
</td>
|
||||
<td>
|
||||
@Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
|
||||
@Html.ActionLink("Details", "Details", new { id=item.ID }) |
|
||||
@Html.ActionLink("Delete", "Delete", new { id=item.ID })
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.displayname)
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
@Html.ActionLink("edit account details", "Edit", null, new { @class = "btn btn-outline-dark" })
|
||||
|
||||
@Html.ActionLink("Logout", "LogOut", null, new { @class = "btn btn-outline-dark" })
|
||||
</div>
|
||||
<br />
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
@Html.ActionLink("Delete Account", "Delete", null, new { @class = "btn btn-outline-dark" })
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
</table>
|
||||
|
||||
@ -39,5 +39,5 @@
|
||||
}
|
||||
|
||||
<div>
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
@Html.ActionLink("don't have an account? register now", "Register")
|
||||
</div>
|
||||
|
||||
@ -10,42 +10,44 @@
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="form-horizontal">
|
||||
<h4>user</h4>
|
||||
<hr />
|
||||
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.usename, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.usename, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.usename, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.password, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.password, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.password, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.displayname, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.displayname, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.displayname, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Create" class="btn btn-outline-dark" />
|
||||
</div>
|
||||
<div class="form-horizontal">
|
||||
<h4>user</h4>
|
||||
<hr />
|
||||
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.usename, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.usename, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.usename, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.password, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.PasswordFor(model => model.password, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.password, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.displayname, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.displayname, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.displayname, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Create" class="btn btn-outline-dark" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div>
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
@Html.ActionLink("already have an account? Login", "Login")
|
||||
</div>
|
||||
|
||||
45
Views/users/allusers.cshtml
Normal file
45
Views/users/allusers.cshtml
Normal file
@ -0,0 +1,45 @@
|
||||
@model IEnumerable<WebApplication1.Models.user>
|
||||
|
||||
@{
|
||||
ViewBag.Title = "allusers";
|
||||
}
|
||||
|
||||
<h2>allusers</h2>
|
||||
|
||||
<p>
|
||||
@Html.ActionLink("Create New", "Create")
|
||||
</p>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.usename)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.password)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.displayname)
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
@foreach (var item in Model) {
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.usename)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.password)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.displayname)
|
||||
</td>
|
||||
<td>
|
||||
@Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
|
||||
@Html.ActionLink("Details", "Details", new { id=item.ID }) |
|
||||
@Html.ActionLink("Delete", "Delete", new { id=item.ID })
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
</table>
|
||||
Reference in New Issue
Block a user