mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Set edit for device reports.
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using DiscImageChef.Server.Models;
|
using DiscImageChef.Server.Models;
|
||||||
@@ -60,8 +61,7 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
|
|||||||
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
|
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||||
[HttpPost, ValidateAntiForgeryToken]
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Edit(
|
public async Task<IActionResult> Edit(
|
||||||
int id, [Bind(
|
int id, [Bind("OptimalMultipleSectorsRead,Id,CompactFlash,Manufacturer,Model,Revision,Type")]
|
||||||
"AddedWhen,ModifiedWhen,OptimalMultipleSectorsRead,Id,CompactFlash,Manufacturer,Model,Revision,Type")]
|
|
||||||
Device device)
|
Device device)
|
||||||
{
|
{
|
||||||
if(id != device.Id)
|
if(id != device.Id)
|
||||||
@@ -69,10 +69,12 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
|
|||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ModelState.IsValid)
|
if(!ModelState.IsValid)
|
||||||
{
|
return View(device);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
device.ModifiedWhen = DateTime.UtcNow;
|
||||||
_context.Update(device);
|
_context.Update(device);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
@@ -89,9 +91,6 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
|
|||||||
return RedirectToAction(nameof(Index));
|
return RedirectToAction(nameof(Index));
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(device);
|
|
||||||
}
|
|
||||||
|
|
||||||
// GET: Admin/Devices/Delete/5
|
// GET: Admin/Devices/Delete/5
|
||||||
public async Task<IActionResult> Delete(int? id)
|
public async Task<IActionResult> Delete(int? id)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
@using DiscImageChef.CommonTypes.Enums
|
||||||
@model Device
|
@model Device
|
||||||
|
|
||||||
@{
|
@{
|
||||||
@@ -39,27 +40,7 @@
|
|||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<form asp-action="Edit">
|
<form asp-action="Edit">
|
||||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="AddedWhen" class="control-label"></label>
|
|
||||||
<input asp-for="AddedWhen" class="form-control" />
|
|
||||||
<span asp-validation-for="AddedWhen" class="text-danger"></span>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="ModifiedWhen" class="control-label"></label>
|
|
||||||
<input asp-for="ModifiedWhen" class="form-control" />
|
|
||||||
<span asp-validation-for="ModifiedWhen" class="text-danger"></span>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="OptimalMultipleSectorsRead" class="control-label"></label>
|
|
||||||
<input asp-for="OptimalMultipleSectorsRead" class="form-control" />
|
|
||||||
<span asp-validation-for="OptimalMultipleSectorsRead" class="text-danger"></span>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" asp-for="Id" />
|
<input type="hidden" asp-for="Id" />
|
||||||
<div class="form-check form-group">
|
|
||||||
<label class="form-check-label">
|
|
||||||
<input class="form-check-input" asp-for="CompactFlash" /> @Html.DisplayNameFor(model => model.CompactFlash)
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="Manufacturer" class="control-label"></label>
|
<label asp-for="Manufacturer" class="control-label"></label>
|
||||||
<input asp-for="Manufacturer" class="form-control" />
|
<input asp-for="Manufacturer" class="form-control" />
|
||||||
@@ -75,9 +56,19 @@
|
|||||||
<input asp-for="Revision" class="form-control" />
|
<input asp-for="Revision" class="form-control" />
|
||||||
<span asp-validation-for="Revision" class="text-danger"></span>
|
<span asp-validation-for="Revision" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-check form-group">
|
||||||
|
<label class="form-check-label">
|
||||||
|
<input class="form-check-input" asp-for="CompactFlash" /> @Html.DisplayNameFor(model => model.CompactFlash)
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="OptimalMultipleSectorsRead" class="control-label"></label>
|
||||||
|
<input asp-for="OptimalMultipleSectorsRead" class="form-control" />
|
||||||
|
<span asp-validation-for="OptimalMultipleSectorsRead" class="text-danger"></span>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="Type" class="control-label"></label>
|
<label asp-for="Type" class="control-label"></label>
|
||||||
<select asp-for="Type" class="form-control"></select>
|
<select asp-for="Type" class="form-control" asp-items="Html.GetEnumSelectList<DeviceType>()"></select>
|
||||||
<span asp-validation-for="Type" class="text-danger"></span>
|
<span asp-validation-for="Type" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|||||||
Reference in New Issue
Block a user