Remove density codes from admin pages.

This commit is contained in:
2019-11-10 14:47:38 +00:00
parent 107d44f0f3
commit 9efa4b6e89
6 changed files with 0 additions and 341 deletions

View File

@@ -1,122 +0,0 @@
using System.Linq;
using System.Threading.Tasks;
using DiscImageChef.CommonTypes.Metadata;
using DiscImageChef.Server.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace DiscImageChef.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class DensityCodesController : Controller
{
readonly DicServerContext _context;
public DensityCodesController(DicServerContext context) => _context = context;
// GET: Admin/DensityCodes
public async Task<IActionResult> Index() => View(await _context.DensityCode.ToListAsync());
// GET: Admin/DensityCodes/Details/5
public async Task<IActionResult> Details(int? id)
{
if(id == null)
{
return NotFound();
}
DensityCode densityCode = await _context.DensityCode.FirstOrDefaultAsync(m => m.Id == id);
if(densityCode == null)
{
return NotFound();
}
return View(densityCode);
}
// GET: Admin/DensityCodes/Edit/5
public async Task<IActionResult> Edit(int? id)
{
if(id == null)
{
return NotFound();
}
DensityCode densityCode = await _context.DensityCode.FindAsync(id);
if(densityCode == null)
{
return NotFound();
}
return View(densityCode);
}
// POST: Admin/DensityCodes/Edit/5
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost, ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(int id, [Bind("Id,Code")] DensityCode densityCode)
{
if(id != densityCode.Id)
{
return NotFound();
}
if(ModelState.IsValid)
{
try
{
_context.Update(densityCode);
await _context.SaveChangesAsync();
}
catch(DbUpdateConcurrencyException)
{
if(!DensityCodeExists(densityCode.Id))
{
return NotFound();
}
throw;
}
return RedirectToAction(nameof(Index));
}
return View(densityCode);
}
// GET: Admin/DensityCodes/Delete/5
public async Task<IActionResult> Delete(int? id)
{
if(id == null)
{
return NotFound();
}
DensityCode densityCode = await _context.DensityCode.FirstOrDefaultAsync(m => m.Id == id);
if(densityCode == null)
{
return NotFound();
}
return View(densityCode);
}
// POST: Admin/DensityCodes/Delete/5
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
DensityCode densityCode = await _context.DensityCode.FindAsync(id);
_context.DensityCode.Remove(densityCode);
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
bool DensityCodeExists(int id) => _context.DensityCode.Any(e => e.Id == id);
}
}

View File

@@ -1,53 +0,0 @@
@model DiscImageChef.CommonTypes.Metadata.DensityCode
@{
Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
ViewBag.Title = "DiscImageChef";
}
@{
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Delete.cshtml
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
}
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>DensityCode</h4>
<hr />
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Code)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Code)
</dd>
</dl>
<form asp-action="Delete">
<input type="hidden" asp-for="Id" />
<a asp-action="Index" class="btn btn-primary">Back to List</a>
<input class="btn btn-danger" type="submit" value="Delete" />
</form>
</div>

View File

@@ -1,51 +0,0 @@
@model DiscImageChef.CommonTypes.Metadata.DensityCode
@{
Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
ViewBag.Title = "DiscImageChef";
}
@{
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Details.cshtml
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
}
<div>
<h4>DensityCode</h4>
<hr />
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Code)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Code)
</dd>
</dl>
</div>
<div>
<a asp-action="Edit" asp-route-id="@Model.Id" class="btn btn-primary">Edit</a>
<a asp-action="Index" class="btn btn-secondary">Back to List</a>
</div>

View File

@@ -1,54 +0,0 @@
@model DiscImageChef.CommonTypes.Metadata.DensityCode
@{
Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
ViewBag.Title = "DiscImageChef";
}
@{
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Edit.cshtml
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
}
<h4>DensityCode</h4>
<hr />
<div class="row">
<div class="col-md-4">
<form asp-action="Edit">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<input type="hidden" asp-for="Id" />
<div class="form-group">
<label asp-for="Code" class="control-label"></label>
<input asp-for="Code" class="form-control" />
<span asp-validation-for="Code" class="text-danger"></span>
</div>
<div class="form-group">
<input class="btn btn-primary" type="submit" value="Save" />
<a asp-action="Index" class="btn btn-secondary">Back to List</a>
</div>
</form>
</div>
</div>

View File

@@ -1,60 +0,0 @@
@model IEnumerable<DiscImageChef.CommonTypes.Metadata.DensityCode>
@{
Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
ViewBag.Title = "DiscImageChef";
}
@{
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Index.cshtml
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
}
<table class="table">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.Code)
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Code)
</td>
<td>
<a asp-action="Details" asp-route-id="@item.Id" class="btn btn-primary">Details</a>
<a asp-action="Edit" asp-route-id="@item.Id" class="btn btn-secondary">Edit</a>
<a asp-action="Delete" asp-route-id="@item.Id" class="btn btn-danger">Delete</a>
</td>
</tr>
}
</tbody>
</table>

View File

@@ -62,7 +62,6 @@ namespace DiscImageChef.Server.Models
public DbSet<CommonTypes.Metadata.Ata> Ata { get; set; }
public DbSet<BlockDescriptor> BlockDescriptor { get; set; }
public DbSet<Chs> Chs { get; set; }
public DbSet<DensityCode> DensityCode { get; set; }
public DbSet<FireWire> FireWire { get; set; }
public DbSet<Mmc> Mmc { get; set; }
public DbSet<MmcSd> MmcSd { get; set; }