From 9efa4b6e8978195a58ff4b5d0b75407f755dd1ba Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 10 Nov 2019 14:47:38 +0000 Subject: [PATCH] Remove density codes from admin pages. --- .../Controllers/DensityCodesController.cs | 122 ------------------ .../Admin/Views/DensityCodes/Delete.cshtml | 53 -------- .../Admin/Views/DensityCodes/Details.cshtml | 51 -------- .../Admin/Views/DensityCodes/Edit.cshtml | 54 -------- .../Admin/Views/DensityCodes/Index.cshtml | 60 --------- DiscImageChef.Server/Models/Context.cs | 1 - 6 files changed, 341 deletions(-) delete mode 100644 DiscImageChef.Server/Areas/Admin/Controllers/DensityCodesController.cs delete mode 100644 DiscImageChef.Server/Areas/Admin/Views/DensityCodes/Delete.cshtml delete mode 100644 DiscImageChef.Server/Areas/Admin/Views/DensityCodes/Details.cshtml delete mode 100644 DiscImageChef.Server/Areas/Admin/Views/DensityCodes/Edit.cshtml delete mode 100644 DiscImageChef.Server/Areas/Admin/Views/DensityCodes/Index.cshtml diff --git a/DiscImageChef.Server/Areas/Admin/Controllers/DensityCodesController.cs b/DiscImageChef.Server/Areas/Admin/Controllers/DensityCodesController.cs deleted file mode 100644 index 0c148bbd..00000000 --- a/DiscImageChef.Server/Areas/Admin/Controllers/DensityCodesController.cs +++ /dev/null @@ -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 Index() => View(await _context.DensityCode.ToListAsync()); - - // GET: Admin/DensityCodes/Details/5 - public async Task 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 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 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 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 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); - } -} \ No newline at end of file diff --git a/DiscImageChef.Server/Areas/Admin/Views/DensityCodes/Delete.cshtml b/DiscImageChef.Server/Areas/Admin/Views/DensityCodes/Delete.cshtml deleted file mode 100644 index b5d2c260..00000000 --- a/DiscImageChef.Server/Areas/Admin/Views/DensityCodes/Delete.cshtml +++ /dev/null @@ -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 - // - // 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 . - // - // ---------------------------------------------------------------------------- - // Copyright © 2011-2019 Natalia Portillo - // ****************************************************************************/ -} -

Are you sure you want to delete this?

-
-

DensityCode

-
-
-
- @Html.DisplayNameFor(model => model.Code) -
-
- @Html.DisplayFor(model => model.Code) -
-
-
- - Back to List - -
-
\ No newline at end of file diff --git a/DiscImageChef.Server/Areas/Admin/Views/DensityCodes/Details.cshtml b/DiscImageChef.Server/Areas/Admin/Views/DensityCodes/Details.cshtml deleted file mode 100644 index c7b43a5c..00000000 --- a/DiscImageChef.Server/Areas/Admin/Views/DensityCodes/Details.cshtml +++ /dev/null @@ -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 - // - // 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 . - // - // ---------------------------------------------------------------------------- - // Copyright © 2011-2019 Natalia Portillo - // ****************************************************************************/ -} -
-

DensityCode

-
-
-
- @Html.DisplayNameFor(model => model.Code) -
-
- @Html.DisplayFor(model => model.Code) -
-
-
- \ No newline at end of file diff --git a/DiscImageChef.Server/Areas/Admin/Views/DensityCodes/Edit.cshtml b/DiscImageChef.Server/Areas/Admin/Views/DensityCodes/Edit.cshtml deleted file mode 100644 index 5532e04c..00000000 --- a/DiscImageChef.Server/Areas/Admin/Views/DensityCodes/Edit.cshtml +++ /dev/null @@ -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 - // - // 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 . - // - // ---------------------------------------------------------------------------- - // Copyright © 2011-2019 Natalia Portillo - // ****************************************************************************/ -} -

DensityCode

-
-
-
-
-
- -
- - - -
-
- - Back to List -
-
-
-
\ No newline at end of file diff --git a/DiscImageChef.Server/Areas/Admin/Views/DensityCodes/Index.cshtml b/DiscImageChef.Server/Areas/Admin/Views/DensityCodes/Index.cshtml deleted file mode 100644 index cb48dc2d..00000000 --- a/DiscImageChef.Server/Areas/Admin/Views/DensityCodes/Index.cshtml +++ /dev/null @@ -1,60 +0,0 @@ -@model IEnumerable - -@{ - Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml"; - ViewBag.Title = "DiscImageChef"; -} -@{ - // /*************************************************************************** - // The Disc Image Chef - // ---------------------------------------------------------------------------- - // - // Filename : Index.cshtml - // Author(s) : Natalia Portillo - // - // 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 . - // - // ---------------------------------------------------------------------------- - // Copyright © 2011-2019 Natalia Portillo - // ****************************************************************************/ -} - - - - - - - - - @foreach (var item in Model) - { - - - - - } - -
- @Html.DisplayNameFor(model => model.Code) -
- @Html.DisplayFor(modelItem => item.Code) - - Details - Edit - Delete -
\ No newline at end of file diff --git a/DiscImageChef.Server/Models/Context.cs b/DiscImageChef.Server/Models/Context.cs index edaa0c91..d3aefe08 100644 --- a/DiscImageChef.Server/Models/Context.cs +++ b/DiscImageChef.Server/Models/Context.cs @@ -62,7 +62,6 @@ namespace DiscImageChef.Server.Models public DbSet Ata { get; set; } public DbSet BlockDescriptor { get; set; } public DbSet Chs { get; set; } - public DbSet DensityCode { get; set; } public DbSet FireWire { get; set; } public DbSet Mmc { get; set; } public DbSet MmcSd { get; set; }