Implemented /Home/Location table and delete action

This commit is contained in:
2025-10-10 09:35:53 +02:00
parent 432a28271b
commit 1e13ea11d7
6 changed files with 67 additions and 37 deletions

View File

@@ -54,9 +54,21 @@ public class HomeController : Controller
}
[HttpGet("Locations")]
public ActionResult Locations()
public async Task<ActionResult> LocationsAsync()
{
return View();
IEnumerable<LocationModel> locations = await _ldap.ListLocationsAsync();
List<LocationTableViewModel> LocationsTableViewModels = [];
foreach (LocationModel location in locations)
{
LocationsTableViewModels.Add(new()
{
LocationID = location.Location,
LocationName = location.Description?.Location ?? "",
RoomNumber = location.Description?.RoomNumber ?? "",
Seat = location.Description?.Seat ?? ""
});
}
return View(new LocationsIndexViewModel() { LocationTableViewModels = LocationsTableViewModels });
}
[HttpGet("Users")]