Fix selecting logo to remove.

This commit is contained in:
2019-05-26 23:24:08 +01:00
parent 75e36ef83b
commit 5a1010ca3a
2 changed files with 4 additions and 2 deletions

View File

@@ -334,7 +334,9 @@ namespace cicm_web.Areas.Admin.Controllers
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
CompanyLogo companyLogo = await _context.CompanyLogos.FindAsync(id);
CompanyLogo companyLogo = await _context.CompanyLogos.FirstOrDefaultAsync(m => m.Id == id);
if(companyLogo == null) return NotFound();
_context.CompanyLogos.Remove(companyLogo);
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));