Implemented live asset table in /Home/Index

This commit is contained in:
2025-10-05 21:29:17 +02:00
parent ee44b7d8c8
commit 43cac9e304
7 changed files with 60 additions and 50 deletions

View File

@@ -22,9 +22,23 @@ public class HomeController : Controller
[Authorize]
[HttpGet("Index")]
[HttpGet("/")]
public IActionResult Index()
public async Task<IActionResult> Index()
{
return View();
IEnumerable<UserModel> users = await _ldap.ListUsersAsync();
IEnumerable<AssetModel> assets = await _ldap.ListDeviceAsync();
IEnumerable<LocationModel> locations = await _ldap.ListLocationsAsync();
List<AssetsTableViewModel> assetsTableViewModels = [];
foreach (AssetModel asset in assets)
{
assetsTableViewModels.Add(new()
{
AssetCn = asset.Cn,
AssetName = asset.Name,
LocationName = asset.Location,
UserUID = asset.Owner?.Split('=')[1],
});
}
return View(new HomeIndexViewModel() { AssetsTableViewModels = assetsTableViewModels });
}
[HttpPost("Login")]