diff --git a/src/Controllers/GroupsController.cs b/src/Controllers/GroupsController.cs index 523fa71..4267263 100644 --- a/src/Controllers/GroupsController.cs +++ b/src/Controllers/GroupsController.cs @@ -19,7 +19,7 @@ public class GroupsController : Controller } [HttpGet("Get")] - public async Task GetAsync(GroupsIndexRequestModel model) + public async Task GetAsync(GroupsGetRequestModel model) { if (model is null) { diff --git a/src/Controllers/LocationsController.cs b/src/Controllers/LocationsController.cs index f4d639d..da82bd4 100644 --- a/src/Controllers/LocationsController.cs +++ b/src/Controllers/LocationsController.cs @@ -19,18 +19,18 @@ public class LocationsController : Controller _logger = logger; } - [HttpGet("Index")] - public async Task Index() + [HttpGet("GetAll")] + public async Task GetAll() { try { IEnumerable list = await _ldap.ListLocationsAsync(); - return new LocationsIndexResponseModel { Locations = list }; + return new LocationsGetAllResponseModel { Locations = list }; } catch (Exception ex) { _logger.LogError("Unable to list locations: {Message} - {StackTrace}", ex.Message, ex.StackTrace); - return new LocationsIndexResponseModel { Locations = [] }; + return new LocationsGetAllResponseModel { Locations = [] }; } } @@ -59,7 +59,7 @@ public class LocationsController : Controller } } - [HttpGet("Delete")] + [HttpDelete("Delete")] public async Task DeleteAsync(string cn) { if (cn is null) diff --git a/src/Controllers/UsersController.cs b/src/Controllers/UsersController.cs index 1228569..4a2a22d 100644 --- a/src/Controllers/UsersController.cs +++ b/src/Controllers/UsersController.cs @@ -22,8 +22,8 @@ public class UsersController : Controller _logger = logger; } - [HttpGet("Index")] - public async Task> Index(UsersIndexRequestModel requestModel) + [HttpGet("GetAll")] + public async Task> GetAll(UsersGetAllRequestModel requestModel) { string? uid = requestModel.Uid; List attributes = ["cn", "sn", "title", "uid", "jpegPhoto", "userPassword", "description"]; @@ -46,7 +46,7 @@ public class UsersController : Controller } } - [HttpGet("Delete")] + [HttpDelete("Delete")] public async Task Delete(string uid) { try diff --git a/src/Models/GroupsRequestModels.cs b/src/Models/GroupsRequestModels.cs index 6ae237e..4ca75f0 100644 --- a/src/Models/GroupsRequestModels.cs +++ b/src/Models/GroupsRequestModels.cs @@ -2,7 +2,7 @@ using System.Text.Json.Serialization; namespace Berufsschule_HAM.Models; -public class GroupsIndexRequestModel +public class GroupsGetRequestModel { public string? Cn { get; set; } public bool GidNumber { get; set; } = true; diff --git a/src/Models/LocationsResponseModels.cs b/src/Models/LocationsResponseModels.cs index bc84892..e362fa2 100644 --- a/src/Models/LocationsResponseModels.cs +++ b/src/Models/LocationsResponseModels.cs @@ -7,7 +7,7 @@ public class LocationsDeleteResponseModel(bool successful, string exception = "N public string? Exception { get; set; } = exception; } -public class LocationsIndexResponseModel +public class LocationsGetAllResponseModel { public required IEnumerable Locations { get; set; } } diff --git a/src/Models/UsersRequestModels.cs b/src/Models/UsersRequestModels.cs index 14361d7..194c037 100644 --- a/src/Models/UsersRequestModels.cs +++ b/src/Models/UsersRequestModels.cs @@ -2,7 +2,7 @@ using System.Text.Json.Serialization; namespace Berufsschule_HAM.Models; -public class UsersIndexRequestModel +public class UsersGetAllRequestModel { public string? Uid { get; set; } = null; public bool Cn { get; set; } = true; diff --git a/src/Views/Home/Locations.cshtml b/src/Views/Home/Locations.cshtml index 11b6d89..d95bf4a 100644 --- a/src/Views/Home/Locations.cshtml +++ b/src/Views/Home/Locations.cshtml @@ -120,7 +120,7 @@ try { const response = await fetch(url, { - method: 'GET', + method: 'DELETE', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' diff --git a/src/Views/Home/Users.cshtml b/src/Views/Home/Users.cshtml index c74f6c7..b1547a1 100644 --- a/src/Views/Home/Users.cshtml +++ b/src/Views/Home/Users.cshtml @@ -126,7 +126,7 @@ try { const response = await fetch(url, { - method: 'GET', + method: 'DELETE', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' diff --git a/src/wwwroot/js/site.js b/src/wwwroot/js/site.js index 07e0710..bfdde28 100644 --- a/src/wwwroot/js/site.js +++ b/src/wwwroot/js/site.js @@ -167,7 +167,7 @@ document.addEventListener('DOMContentLoaded', () => { async function loadLocationsIntoSelect(selectElement, selectedValue = null) { try { - const response = await fetch('/Locations/Index'); + const response = await fetch('/Locations/GetAll'); const data = await response.json(); const locations = data.locations; @@ -208,7 +208,7 @@ async function loadLocationsIntoSelect(selectElement, selectedValue = null) { async function loadUsersIntoSelect(selectElement, selectedValue = null) { try { - const response = await fetch('/Users/Index?Cn=false&Sn=false&Title=false&Description=false&JpegPhoto=false&UserPassword=false'); + const response = await fetch('/Users/GetAll?Cn=false&Sn=false&Title=false&Description=false&JpegPhoto=false&UserPassword=false'); const users = await response.json(); const ts = selectElement.tomselect;