mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Implement link device report with device stat.
This commit is contained in:
@@ -323,5 +323,28 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
|
|||||||
Id = deviceId
|
Id = deviceId
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IActionResult LinkReports(int? statsId, int? deviceId)
|
||||||
|
{
|
||||||
|
if(statsId is null ||
|
||||||
|
deviceId is null)
|
||||||
|
return NotFound();
|
||||||
|
|
||||||
|
Device device = _context.Devices.FirstOrDefault(m => m.Id == deviceId);
|
||||||
|
DeviceStat stat = _context.DeviceStats.FirstOrDefault(m => m.Id == statsId);
|
||||||
|
|
||||||
|
if(device is null ||
|
||||||
|
stat is null)
|
||||||
|
return NotFound();
|
||||||
|
|
||||||
|
stat.Report = device;
|
||||||
|
_context.Update(stat);
|
||||||
|
_context.SaveChanges();
|
||||||
|
|
||||||
|
return RedirectToAction(nameof(Details), new
|
||||||
|
{
|
||||||
|
Id = deviceId
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -313,7 +313,14 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@("Yes")
|
@if (item.Report.Id == Model.Report.Id)
|
||||||
|
{
|
||||||
|
@("Us")
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
@("Yes")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
Reference in New Issue
Block a user