Remove details and edit from media formats.

This commit is contained in:
2019-11-10 23:40:57 +00:00
parent 6761728bb2
commit 8b0932a5d9
4 changed files with 0 additions and 191 deletions

View File

@@ -1,4 +1,3 @@
using System.Linq;
using System.Threading.Tasks;
using DiscImageChef.Server.Models;
using Microsoft.AspNetCore.Authorization;
@@ -17,76 +16,6 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
// GET: Admin/MediaFormats
public async Task<IActionResult> Index() => View(await _context.MediaFormats.ToListAsync());
// GET: Admin/MediaFormats/Details/5
public async Task<IActionResult> Details(int? id)
{
if(id == null)
{
return NotFound();
}
MediaFormat mediaFormat = await _context.MediaFormats.FirstOrDefaultAsync(m => m.Id == id);
if(mediaFormat == null)
{
return NotFound();
}
return View(mediaFormat);
}
// GET: Admin/MediaFormats/Edit/5
public async Task<IActionResult> Edit(int? id)
{
if(id == null)
{
return NotFound();
}
MediaFormat mediaFormat = await _context.MediaFormats.FindAsync(id);
if(mediaFormat == null)
{
return NotFound();
}
return View(mediaFormat);
}
// POST: Admin/MediaFormats/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")] MediaFormat mediaFormat)
{
if(id != mediaFormat.Id)
{
return NotFound();
}
if(ModelState.IsValid)
{
try
{
_context.Update(mediaFormat);
await _context.SaveChangesAsync();
}
catch(DbUpdateConcurrencyException)
{
if(!MediaFormatExists(mediaFormat.Id))
{
return NotFound();
}
throw;
}
return RedirectToAction(nameof(Index));
}
return View(mediaFormat);
}
// GET: Admin/MediaFormats/Delete/5
public async Task<IActionResult> Delete(int? id)
{
@@ -115,7 +44,5 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
return RedirectToAction(nameof(Index));
}
bool MediaFormatExists(int id) => _context.MediaFormats.Any(e => e.Id == id);
}
}