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 versions.
This commit is contained in:
@@ -16,106 +16,5 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
|
|||||||
|
|
||||||
// GET: Admin/Versions
|
// GET: Admin/Versions
|
||||||
public async Task<IActionResult> Index() => View(await _context.Versions.ToListAsync());
|
public async Task<IActionResult> Index() => View(await _context.Versions.ToListAsync());
|
||||||
|
|
||||||
// GET: Admin/Versions/Details/5
|
|
||||||
public async Task<IActionResult> Details(int? id)
|
|
||||||
{
|
|
||||||
if(id == null)
|
|
||||||
{
|
|
||||||
return NotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
Version version = await _context.Versions.FirstOrDefaultAsync(m => m.Id == id);
|
|
||||||
|
|
||||||
if(version == null)
|
|
||||||
{
|
|
||||||
return NotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
return View(version);
|
|
||||||
}
|
|
||||||
|
|
||||||
// GET: Admin/Versions/Edit/5
|
|
||||||
public async Task<IActionResult> Edit(int? id)
|
|
||||||
{
|
|
||||||
if(id == null)
|
|
||||||
{
|
|
||||||
return NotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
Version version = await _context.Versions.FindAsync(id);
|
|
||||||
|
|
||||||
if(version == null)
|
|
||||||
{
|
|
||||||
return NotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
return View(version);
|
|
||||||
}
|
|
||||||
|
|
||||||
// POST: Admin/Versions/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,Value,Count")] Version version)
|
|
||||||
{
|
|
||||||
if(id != version.Id)
|
|
||||||
{
|
|
||||||
return NotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ModelState.IsValid)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_context.Update(version);
|
|
||||||
await _context.SaveChangesAsync();
|
|
||||||
}
|
|
||||||
catch(DbUpdateConcurrencyException)
|
|
||||||
{
|
|
||||||
if(!VersionExists(version.Id))
|
|
||||||
{
|
|
||||||
return NotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
return RedirectToAction(nameof(Index));
|
|
||||||
}
|
|
||||||
|
|
||||||
return View(version);
|
|
||||||
}
|
|
||||||
|
|
||||||
// GET: Admin/Versions/Delete/5
|
|
||||||
public async Task<IActionResult> Delete(int? id)
|
|
||||||
{
|
|
||||||
if(id == null)
|
|
||||||
{
|
|
||||||
return NotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
Version version = await _context.Versions.FirstOrDefaultAsync(m => m.Id == id);
|
|
||||||
|
|
||||||
if(version == null)
|
|
||||||
{
|
|
||||||
return NotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
return View(version);
|
|
||||||
}
|
|
||||||
|
|
||||||
// POST: Admin/Versions/Delete/5
|
|
||||||
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
|
|
||||||
public async Task<IActionResult> DeleteConfirmed(int id)
|
|
||||||
{
|
|
||||||
Version version = await _context.Versions.FindAsync(id);
|
|
||||||
_context.Versions.Remove(version);
|
|
||||||
await _context.SaveChangesAsync();
|
|
||||||
|
|
||||||
return RedirectToAction(nameof(Index));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool VersionExists(int id) => _context.Versions.Any(e => e.Id == id);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
@model DiscImageChef.Server.Models.Version
|
|
||||||
|
|
||||||
@{
|
|
||||||
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>Version</h4>
|
|
||||||
<hr />
|
|
||||||
<dl class="row">
|
|
||||||
<dt class="col-sm-2">
|
|
||||||
@Html.DisplayNameFor(model => model.Value)
|
|
||||||
</dt>
|
|
||||||
<dd class="col-sm-10">
|
|
||||||
@Html.DisplayFor(model => model.Value)
|
|
||||||
</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 DiscImageChef.Server.Models.Version
|
|
||||||
|
|
||||||
@{
|
|
||||||
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>Version</h4>
|
|
||||||
<hr />
|
|
||||||
<dl class="row">
|
|
||||||
<dt class="col-sm-2">
|
|
||||||
@Html.DisplayNameFor(model => model.Value)
|
|
||||||
</dt>
|
|
||||||
<dd class="col-sm-10">
|
|
||||||
@Html.DisplayFor(model => model.Value)
|
|
||||||
</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 DiscImageChef.Server.Models.Version
|
|
||||||
|
|
||||||
@{
|
|
||||||
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>Version</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="Value" class="control-label"></label>
|
|
||||||
<input asp-for="Value" class="form-control" />
|
|
||||||
<span asp-validation-for="Value" 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>
|
|
||||||
@@ -56,8 +56,6 @@
|
|||||||
@Html.DisplayFor(modelItem => item.Count)
|
@Html.DisplayFor(modelItem => item.Count)
|
||||||
</td>
|
</td>
|
||||||
<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>
|
<a asp-action="Delete" asp-route-id="@item.Id" class="btn btn-danger">Delete</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user