Disable delete, details and edit in versions.

This commit is contained in:
2019-11-10 23:52:19 +00:00
parent e9c5ea326e
commit d42ee68c39
5 changed files with 0 additions and 278 deletions

View File

@@ -16,106 +16,5 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
// GET: Admin/Versions
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);
}
}