Reformat.

This commit is contained in:
2019-11-08 20:30:13 +00:00
parent 86ae22c42f
commit 8db64d17ae
189 changed files with 10672 additions and 12092 deletions

View File

@@ -1,43 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using DiscImageChef.Server.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace DiscImageChef.Server.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
[Area("Admin"), Authorize]
public class AtasController : Controller
{
private readonly DicServerContext _context;
readonly DicServerContext _context;
public AtasController(DicServerContext context)
{
_context = context;
}
public AtasController(DicServerContext context) => _context = context;
// GET: Admin/Atas
public IActionResult Index()
{
return View(_context.Ata.AsEnumerable().Where(m=>m.IdentifyDevice?.Model != null).OrderBy(m => m.IdentifyDevice.Value.Model));
}
public IActionResult Index() => View(_context.Ata.AsEnumerable().Where(m => m.IdentifyDevice?.Model != null).
OrderBy(m => m.IdentifyDevice.Value.Model));
// GET: Admin/Atas/Details/5
public async Task<IActionResult> Details(int? id)
{
if (id == null)
if(id == null)
{
return NotFound();
}
var ata = await _context.Ata
.FirstOrDefaultAsync(m => m.Id == id);
if (ata == null)
CommonTypes.Metadata.Ata ata = await _context.Ata.FirstOrDefaultAsync(m => m.Id == id);
if(ata == null)
{
return NotFound();
}
@@ -46,38 +37,36 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
}
// GET: Admin/Atas/Create
public IActionResult Create()
{
return View();
}
public IActionResult Create() => View();
// POST: Admin/Atas/Create
// 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> Create([Bind("Id,Identify")] DiscImageChef.CommonTypes.Metadata.Ata ata)
[HttpPost, ValidateAntiForgeryToken]
public async Task<IActionResult> Create([Bind("Id,Identify")] CommonTypes.Metadata.Ata ata)
{
if (ModelState.IsValid)
if(ModelState.IsValid)
{
_context.Add(ata);
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
return View(ata);
}
// GET: Admin/Atas/Delete/5
public async Task<IActionResult> Delete(int? id)
{
if (id == null)
if(id == null)
{
return NotFound();
}
var ata = await _context.Ata
.FirstOrDefaultAsync(m => m.Id == id);
if (ata == null)
CommonTypes.Metadata.Ata ata = await _context.Ata.FirstOrDefaultAsync(m => m.Id == id);
if(ata == null)
{
return NotFound();
}
@@ -86,19 +75,16 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
}
// POST: Admin/Atas/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
var ata = await _context.Ata.FindAsync(id);
CommonTypes.Metadata.Ata ata = await _context.Ata.FindAsync(id);
_context.Ata.Remove(ata);
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
private bool AtaExists(int id)
{
return _context.Ata.Any(e => e.Id == id);
}
bool AtaExists(int id) => _context.Ata.Any(e => e.Id == id);
}
}
}