mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Disable delete, details and edit in filesystems.
This commit is contained in:
@@ -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/Filesystems
|
||||
public async Task<IActionResult> Index() => View(await _context.Filesystems.ToListAsync());
|
||||
|
||||
// GET: Admin/Filesystems/Details/5
|
||||
public async Task<IActionResult> Details(int? id)
|
||||
{
|
||||
if(id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
Filesystem filesystem = await _context.Filesystems.FirstOrDefaultAsync(m => m.Id == id);
|
||||
|
||||
if(filesystem == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(filesystem);
|
||||
}
|
||||
|
||||
// GET: Admin/Filesystems/Edit/5
|
||||
public async Task<IActionResult> Edit(int? id)
|
||||
{
|
||||
if(id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
Filesystem filesystem = await _context.Filesystems.FindAsync(id);
|
||||
|
||||
if(filesystem == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(filesystem);
|
||||
}
|
||||
|
||||
// POST: Admin/Filesystems/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,Name,Count")] Filesystem filesystem)
|
||||
{
|
||||
if(id != filesystem.Id)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
if(ModelState.IsValid)
|
||||
{
|
||||
try
|
||||
{
|
||||
_context.Update(filesystem);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
catch(DbUpdateConcurrencyException)
|
||||
{
|
||||
if(!FilesystemExists(filesystem.Id))
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
|
||||
return View(filesystem);
|
||||
}
|
||||
|
||||
// GET: Admin/Filesystems/Delete/5
|
||||
public async Task<IActionResult> Delete(int? id)
|
||||
{
|
||||
if(id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
Filesystem filesystem = await _context.Filesystems.FirstOrDefaultAsync(m => m.Id == id);
|
||||
|
||||
if(filesystem == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(filesystem);
|
||||
}
|
||||
|
||||
// POST: Admin/Filesystems/Delete/5
|
||||
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> DeleteConfirmed(int id)
|
||||
{
|
||||
Filesystem filesystem = await _context.Filesystems.FindAsync(id);
|
||||
_context.Filesystems.Remove(filesystem);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
|
||||
bool FilesystemExists(int id) => _context.Filesystems.Any(e => e.Id == id);
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
@model Filesystem
|
||||
|
||||
@{
|
||||
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>Filesystem</h4>
|
||||
<hr />
|
||||
<dl class="row">
|
||||
<dt class="col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Name)
|
||||
</dt>
|
||||
<dd class="col-sm-10">
|
||||
@Html.DisplayFor(model => model.Name)
|
||||
</dd>
|
||||
<dt class="col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Count)
|
||||
</dt>
|
||||
<dd class="col-sm-10">
|
||||
@Html.DisplayFor(model => model.Count)
|
||||
</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>
|
||||
@@ -1,57 +0,0 @@
|
||||
@model Filesystem
|
||||
|
||||
@{
|
||||
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>Filesystem</h4>
|
||||
<hr />
|
||||
<dl class="row">
|
||||
<dt class="col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Name)
|
||||
</dt>
|
||||
<dd class="col-sm-10">
|
||||
@Html.DisplayFor(model => model.Name)
|
||||
</dd>
|
||||
<dt class="col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Count)
|
||||
</dt>
|
||||
<dd class="col-sm-10">
|
||||
@Html.DisplayFor(model => model.Count)
|
||||
</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>
|
||||
@@ -1,59 +0,0 @@
|
||||
@model Filesystem
|
||||
|
||||
@{
|
||||
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>Filesystem</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="Name" class="control-label"></label>
|
||||
<input asp-for="Name" class="form-control" />
|
||||
<span asp-validation-for="Name" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Count" class="control-label"></label>
|
||||
<input asp-for="Count" class="form-control" />
|
||||
<span asp-validation-for="Count" 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>
|
||||
@@ -42,7 +42,6 @@
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Count)
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -55,11 +54,6 @@
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Count)
|
||||
</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>
|
||||
|
||||
Reference in New Issue
Block a user