Disable details and edit from medias.

This commit is contained in:
2019-11-11 00:14:59 +00:00
parent 6fc1ec6745
commit c3617599ac
3 changed files with 0 additions and 199 deletions

View File

@@ -17,76 +17,6 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
// GET: Admin/Medias
public async Task<IActionResult> Index() => View(await _context.Medias.ToListAsync());
// GET: Admin/Medias/Details/5
public async Task<IActionResult> Details(int? id)
{
if(id == null)
{
return NotFound();
}
Media media = await _context.Medias.FirstOrDefaultAsync(m => m.Id == id);
if(media == null)
{
return NotFound();
}
return View(media);
}
// GET: Admin/Medias/Edit/5
public async Task<IActionResult> Edit(int? id)
{
if(id == null)
{
return NotFound();
}
Media media = await _context.Medias.FindAsync(id);
if(media == null)
{
return NotFound();
}
return View(media);
}
// POST: Admin/Medias/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,Type,Real,Count")] Media media)
{
if(id != media.Id)
{
return NotFound();
}
if(ModelState.IsValid)
{
try
{
_context.Update(media);
await _context.SaveChangesAsync();
}
catch(DbUpdateConcurrencyException)
{
if(!MediaExists(media.Id))
{
return NotFound();
}
throw;
}
return RedirectToAction(nameof(Index));
}
return View(media);
}
// GET: Admin/Medias/Delete/5
public async Task<IActionResult> Delete(int? id)
{
@@ -115,7 +45,5 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
return RedirectToAction(nameof(Index));
}
bool MediaExists(int id) => _context.Medias.Any(e => e.Id == id);
}
}

View File

@@ -1,63 +0,0 @@
@model Media
@{
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>Media</h4>
<hr />
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Type)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Type)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Real)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Real)
</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>

View File

@@ -1,64 +0,0 @@
@model Media
@{
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>Media</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="Type" class="control-label"></label>
<input asp-for="Type" class="form-control" />
<span asp-validation-for="Type" class="text-danger"></span>
</div>
<div class="form-check form-group">
<label class="form-check-label">
<input class="form-check-input" asp-for="Real" /> @Html.DisplayNameFor(model => model.Real)
</label>
</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>