Automatically update modified date when editing a compact disc offset.

This commit is contained in:
2019-11-10 14:17:25 +00:00
parent d129202d59
commit ee60399c9b

View File

@@ -42,9 +42,8 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
// To protect from overposting attacks, please enable the specific properties you want to bind to, for // 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. // 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("Id,Manufacturer,Model,Offset,Submissions,Agreement")]
int id, [Bind("Id,Manufacturer,Model,Offset,Submissions,Agreement")] CompactDiscOffset compactDiscOffset)
CompactDiscOffset compactDiscOffset)
{ {
if(id != compactDiscOffset.Id) if(id != compactDiscOffset.Id)
{ {
@@ -56,6 +55,7 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
try try
{ {
compactDiscOffset.ModifiedWhen = DateTime.UtcNow;
_context.Update(compactDiscOffset); _context.Update(compactDiscOffset);
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
} }
@@ -70,7 +70,6 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
} }
return RedirectToAction(nameof(Index)); return RedirectToAction(nameof(Index));
} }
// GET: Admin/CompactDiscOffsets/Delete/5 // GET: Admin/CompactDiscOffsets/Delete/5
@@ -104,9 +103,6 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
bool CompactDiscOffsetExists(int id) => _context.CdOffsets.Any(e => e.Id == id); bool CompactDiscOffsetExists(int id) => _context.CdOffsets.Any(e => e.Id == id);
public IActionResult Update() public IActionResult Update() => throw new NotImplementedException();
{
throw new NotImplementedException();
}
} }
} }