Updated admin panel
This commit is contained in:
@@ -2,12 +2,14 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using MyWebsite.Models;
|
||||
|
||||
namespace MyWebsite.Areas.Admin.Controllers
|
||||
{
|
||||
[Area("Admin")]
|
||||
[Authorize]
|
||||
public class ContactsController : Controller
|
||||
{
|
||||
public ContactsController(DatabaseContext context) =>
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
@using MyWebsite.Models;
|
||||
@model Link;
|
||||
@{
|
||||
ViewData["Title"] = "Edit link";
|
||||
}
|
||||
|
||||
<header>
|
||||
<h1>Edit contact link</h1>
|
||||
<p> <a asp-action="Index">Back to the list</a></p>
|
||||
</header>
|
||||
|
||||
<article>
|
||||
<form asp-action="Edit">
|
||||
<div asp-validation-summary="ModelOnly" class="validation-summary-errors"></div>
|
||||
<div>
|
||||
<label asp-for="Name"></label>
|
||||
<input asp-for="Name" />
|
||||
<span asp-validation-for="Name"></span>
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="Title"></label>
|
||||
<input asp-for="Title" />
|
||||
<span asp-validation-for="Title"></span>
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="Username"></label>
|
||||
<input asp-for="Username" />
|
||||
<span asp-validation-for="Username"></span>
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="Url"></label>
|
||||
<input asp-for="Url" />
|
||||
<span asp-validation-for="Url"></span>
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="CanContactMe">@Html.DisplayNameFor(model => model.CanContactMe)</label>
|
||||
<input style="width:auto" type="checkbox" asp-for="CanContactMe" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Save"/>
|
||||
</div>
|
||||
</form>
|
||||
</article>
|
||||
|
||||
<link type="text/css" rel="stylesheet" href="~/css/Admin.css" />
|
||||
@@ -1,32 +1,51 @@
|
||||
@model IEnumerable<MyWebsite.Models.Link>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Contacts - Admin panel";
|
||||
ViewData["Title"] = "Index";
|
||||
}
|
||||
|
||||
<header>
|
||||
<h1>Contact links list</h1>
|
||||
<p> <a asp-action="Index" asp-controller="Admin" asp-area="">Back to admin panel</a></p>
|
||||
<h1>Index</h1>
|
||||
<p>
|
||||
<a asp-action="Create" class="comment">// + Create New</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<article>
|
||||
<p>
|
||||
<a class="comment" asp-action="Create">// + Create New</a>
|
||||
</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Title</th>
|
||||
<th>Username</th>
|
||||
<th>URL</th>
|
||||
<th>Contact link</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Id)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Name)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Title)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Username)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Url)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.CanContactMe)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.DisplayInFooter)
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model.OrderByDescending(i => i.CanContactMe))
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Id)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Name)
|
||||
</td>
|
||||
@@ -43,8 +62,11 @@
|
||||
@Html.DisplayFor(modelItem => item.CanContactMe)
|
||||
</td>
|
||||
<td>
|
||||
@Html.ActionLink("Edit", "Edit", new { id = item.Name }) |
|
||||
@Html.ActionLink("Delete", "Delete", new { id = item.Name })
|
||||
@Html.DisplayFor(modelItem => item.DisplayInFooter)
|
||||
</td>
|
||||
<td>
|
||||
@Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
|
||||
@Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
@@ -4,6 +4,13 @@
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="wwwroot\projects-assets\**" />
|
||||
<Content Remove="wwwroot\projects-assets\**" />
|
||||
<EmbeddedResource Remove="wwwroot\projects-assets\**" />
|
||||
<None Remove="wwwroot\projects-assets\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Areas\Admin\NewFile.txt" />
|
||||
</ItemGroup>
|
||||
@@ -18,7 +25,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Areas\Admin\Views\Shared\" />
|
||||
<Folder Include="wwwroot\projects-assets\FoxTube\" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
<article>
|
||||
<p class="admin-menu">
|
||||
<a asp-action="FoxTube" class="comment">// FoxTube API</a><br />
|
||||
<a asp-action="Artworks" class="comment">// Artworks</a><br />
|
||||
<a asp-action="Projects" class="comment">// Projects</a><br />
|
||||
<a asp-action="Badges" class="comment">// Badges</a><br />
|
||||
|
||||
@@ -28,11 +28,11 @@
|
||||
<a asp-controller="Home" asp-action="Index">XFox111.NET</a>
|
||||
|
||||
<menu type="toolbar" class="main-menu" style="display:none">
|
||||
<li><a asp-controller="Home" asp-action="Index">AboutMe();</a></li>
|
||||
<li><a asp-controller="Resume" asp-action="Index">Resume();</a></li>
|
||||
<li><a asp-controller="Projects" asp-action="Index">Projects();</a></li>
|
||||
<li><a asp-controller="Gallery" asp-action="Index">Arts();</a></li>
|
||||
<li><a asp-controller="Contacts" asp-action="Index">Contacts();</a></li>
|
||||
<li><a asp-area="" asp-controller="Home" asp-action="Index">AboutMe();</a></li>
|
||||
<li><a asp-area="" asp-controller="Resume" asp-action="Index">Resume();</a></li>
|
||||
<li><a asp-area="" asp-controller="Projects" asp-action="Index">Projects();</a></li>
|
||||
<li><a asp-area="" asp-controller="Gallery" asp-action="Index">Arts();</a></li>
|
||||
<li><a asp-area="" asp-controller="Contacts" asp-action="Index">Contacts();</a></li>
|
||||
</menu>
|
||||
|
||||
<a class="language-switch" asp-controller="Home" asp-action="SwitchLanguage" lang="ru">РУС </a>
|
||||
|
||||
Reference in New Issue
Block a user