From fe6f8a67164d6873d11b1a5b2b3520aed6fe89c6 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 10 Nov 2019 23:02:36 +0000 Subject: [PATCH] Disable delete, details and edit in filters. --- .../Admin/Controllers/FiltersController.cs | 102 ------------------ .../Areas/Admin/Views/Filters/Delete.cshtml | 59 ---------- .../Areas/Admin/Views/Filters/Details.cshtml | 57 ---------- .../Areas/Admin/Views/Filters/Edit.cshtml | 59 ---------- .../Areas/Admin/Views/Filters/Index.cshtml | 6 -- 5 files changed, 283 deletions(-) delete mode 100644 DiscImageChef.Server/Areas/Admin/Views/Filters/Delete.cshtml delete mode 100644 DiscImageChef.Server/Areas/Admin/Views/Filters/Details.cshtml delete mode 100644 DiscImageChef.Server/Areas/Admin/Views/Filters/Edit.cshtml diff --git a/DiscImageChef.Server/Areas/Admin/Controllers/FiltersController.cs b/DiscImageChef.Server/Areas/Admin/Controllers/FiltersController.cs index 582aefd0..7c6b4b26 100644 --- a/DiscImageChef.Server/Areas/Admin/Controllers/FiltersController.cs +++ b/DiscImageChef.Server/Areas/Admin/Controllers/FiltersController.cs @@ -1,4 +1,3 @@ -using System.Linq; using System.Threading.Tasks; using DiscImageChef.Server.Models; using Microsoft.AspNetCore.Authorization; @@ -16,106 +15,5 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers // GET: Admin/Filters public async Task Index() => View(await _context.Filters.ToListAsync()); - - // GET: Admin/Filters/Details/5 - public async Task Details(int? id) - { - if(id == null) - { - return NotFound(); - } - - Filter filter = await _context.Filters.FirstOrDefaultAsync(m => m.Id == id); - - if(filter == null) - { - return NotFound(); - } - - return View(filter); - } - - // GET: Admin/Filters/Edit/5 - public async Task Edit(int? id) - { - if(id == null) - { - return NotFound(); - } - - Filter filter = await _context.Filters.FindAsync(id); - - if(filter == null) - { - return NotFound(); - } - - return View(filter); - } - - // POST: Admin/Filters/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,Name,Count")] Filter filter) - { - if(id != filter.Id) - { - return NotFound(); - } - - if(ModelState.IsValid) - { - try - { - _context.Update(filter); - await _context.SaveChangesAsync(); - } - catch(DbUpdateConcurrencyException) - { - if(!FilterExists(filter.Id)) - { - return NotFound(); - } - - throw; - } - - return RedirectToAction(nameof(Index)); - } - - return View(filter); - } - - // GET: Admin/Filters/Delete/5 - public async Task Delete(int? id) - { - if(id == null) - { - return NotFound(); - } - - Filter filter = await _context.Filters.FirstOrDefaultAsync(m => m.Id == id); - - if(filter == null) - { - return NotFound(); - } - - return View(filter); - } - - // POST: Admin/Filters/Delete/5 - [HttpPost, ActionName("Delete"), ValidateAntiForgeryToken] - public async Task DeleteConfirmed(int id) - { - Filter filter = await _context.Filters.FindAsync(id); - _context.Filters.Remove(filter); - await _context.SaveChangesAsync(); - - return RedirectToAction(nameof(Index)); - } - - bool FilterExists(int id) => _context.Filters.Any(e => e.Id == id); } } \ No newline at end of file diff --git a/DiscImageChef.Server/Areas/Admin/Views/Filters/Delete.cshtml b/DiscImageChef.Server/Areas/Admin/Views/Filters/Delete.cshtml deleted file mode 100644 index 2b811261..00000000 --- a/DiscImageChef.Server/Areas/Admin/Views/Filters/Delete.cshtml +++ /dev/null @@ -1,59 +0,0 @@ -@model Filter - -@{ - 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?

-
-

Filter

-
-
-
- @Html.DisplayNameFor(model => model.Name) -
-
- @Html.DisplayFor(model => model.Name) -
-
- @Html.DisplayNameFor(model => model.Count) -
-
- @Html.DisplayFor(model => model.Count) -
-
-
- - Back to List - -
-
\ No newline at end of file diff --git a/DiscImageChef.Server/Areas/Admin/Views/Filters/Details.cshtml b/DiscImageChef.Server/Areas/Admin/Views/Filters/Details.cshtml deleted file mode 100644 index ac952150..00000000 --- a/DiscImageChef.Server/Areas/Admin/Views/Filters/Details.cshtml +++ /dev/null @@ -1,57 +0,0 @@ -@model Filter - -@{ - 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 - // ****************************************************************************/ -} -
-

Filter

-
-
-
- @Html.DisplayNameFor(model => model.Name) -
-
- @Html.DisplayFor(model => model.Name) -
-
- @Html.DisplayNameFor(model => model.Count) -
-
- @Html.DisplayFor(model => model.Count) -
-
-
- \ No newline at end of file diff --git a/DiscImageChef.Server/Areas/Admin/Views/Filters/Edit.cshtml b/DiscImageChef.Server/Areas/Admin/Views/Filters/Edit.cshtml deleted file mode 100644 index 9c4f1ac2..00000000 --- a/DiscImageChef.Server/Areas/Admin/Views/Filters/Edit.cshtml +++ /dev/null @@ -1,59 +0,0 @@ -@model Filter - -@{ - 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 - // ****************************************************************************/ -} -

Filter

-
-
-
-
-
- -
- - - -
-
- - - -
-
- - Back to List -
-
-
-
\ No newline at end of file diff --git a/DiscImageChef.Server/Areas/Admin/Views/Filters/Index.cshtml b/DiscImageChef.Server/Areas/Admin/Views/Filters/Index.cshtml index 1bcb981f..d6ba3e9b 100644 --- a/DiscImageChef.Server/Areas/Admin/Views/Filters/Index.cshtml +++ b/DiscImageChef.Server/Areas/Admin/Views/Filters/Index.cshtml @@ -42,7 +42,6 @@ @Html.DisplayNameFor(model => model.Count) - @@ -55,11 +54,6 @@ @Html.DisplayFor(modelItem => item.Count) - - Details - Edit - Delete - }