mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Implemented live asset table in /Home/Index
This commit is contained in:
@@ -19,7 +19,7 @@ public class AssetsController : Controller
|
||||
}
|
||||
|
||||
[HttpGet("Index")]
|
||||
public async Task<IEnumerable<Dictionary<string, string>>> Index()
|
||||
public async Task<IEnumerable<AssetModel>> Index()
|
||||
{
|
||||
var list = await _ldap.ListDeviceAsync();
|
||||
return list;
|
||||
|
||||
@@ -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")]
|
||||
|
||||
@@ -18,9 +18,9 @@ public class LocationsController : Controller
|
||||
}
|
||||
|
||||
[HttpGet("Index")]
|
||||
public async Task<IEnumerable<Dictionary<string, string>>> Index()
|
||||
public async Task<IEnumerable<LocationModel>> Index()
|
||||
{
|
||||
IEnumerable<Dictionary<string, string>> list = await _ldap.ListLocationsAsync();
|
||||
IEnumerable<LocationModel> list = await _ldap.ListLocationsAsync();
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user