Remove edit from SSCs.

This commit is contained in:
2019-11-17 20:20:06 +00:00
parent aa0516dc9e
commit 593f285ed4
5 changed files with 2 additions and 122 deletions

View File

@@ -36,59 +36,6 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
return View(ssc);
}
// GET: Admin/Sscs/Edit/5
public async Task<IActionResult> Edit(int? id)
{
if(id == null)
{
return NotFound();
}
Ssc ssc = await _context.Ssc.FindAsync(id);
if(ssc == null)
{
return NotFound();
}
return View(ssc);
}
// POST: Admin/Sscs/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,BlockSizeGranularity,MaxBlockLength,MinBlockLength")]
Ssc ssc)
{
if(id != ssc.Id)
{
return NotFound();
}
if(ModelState.IsValid)
{
try
{
_context.Update(ssc);
await _context.SaveChangesAsync();
}
catch(DbUpdateConcurrencyException)
{
if(!SscExists(ssc.Id))
{
return NotFound();
}
throw;
}
return RedirectToAction(nameof(Index));
}
return View(ssc);
}
// GET: Admin/Sscs/Delete/5
public async Task<IActionResult> Delete(int? id)
{
@@ -117,7 +64,5 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
return RedirectToAction(nameof(Index));
}
bool SscExists(int id) => _context.Ssc.Any(e => e.Id == id);
}
}

View File

@@ -51,5 +51,6 @@
<a asp-action="Index" asp-controller="Partitions">Partitioning schemes detected</a>
<a asp-action="Index" asp-controller="Pcmcias">PCMCIA card registers</a>
<a asp-action="Index" asp-controller="ScsiModes">SCSI MODE SENSE responses</a>
<a asp-action="Index" asp-controller="ScsiModes">SCSI MODE SENSE pages</a>
<a asp-action="Index" asp-controller="ScsiPages">SCSI MODE SENSE pages</a>
<a asp-action="Index" asp-controller="Scsis">SCSI INQUIRY responses</a>
<a asp-action="Index" asp-controller="Versions">DiscImageChef versions used</a>

View File

@@ -58,6 +58,5 @@
</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,64 +0,0 @@
@model DiscImageChef.CommonTypes.Metadata.Ssc
@{
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>Ssc</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="BlockSizeGranularity" class="control-label"></label>
<input asp-for="BlockSizeGranularity" class="form-control" />
<span asp-validation-for="BlockSizeGranularity" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="MaxBlockLength" class="control-label"></label>
<input asp-for="MaxBlockLength" class="form-control" />
<span asp-validation-for="MaxBlockLength" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="MinBlockLength" class="control-label"></label>
<input asp-for="MinBlockLength" class="form-control" />
<span asp-validation-for="MinBlockLength" 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

@@ -63,7 +63,6 @@
</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>