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