add user managment(edit/delete/logout) and session

This commit is contained in:
2024-07-27 17:17:28 +03:30
parent 09f9d07f03
commit 08277427c7
12 changed files with 226 additions and 242 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -39,5 +39,5 @@
}
<div>
@Html.ActionLink("Back to List", "Index")
@Html.ActionLink("don't have an account? register now", "Register")
</div>

View File

@ -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>

View 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>