diff --git a/src/Controllers/LocationsController.cs b/src/Controllers/LocationsController.cs index ff58718..02e62e9 100644 --- a/src/Controllers/LocationsController.cs +++ b/src/Controllers/LocationsController.cs @@ -26,8 +26,8 @@ public class LocationsController : Controller return list; } - [HttpGet("Create")] - public async Task Create(LocationsCreateRequestModel model) + [HttpPost("Create")] + public async Task Create([FromBody]LocationsCreateRequestModel model) { try { diff --git a/src/Models/LocationsRequestModels.cs b/src/Models/LocationsRequestModels.cs index 501c25d..522913e 100644 --- a/src/Models/LocationsRequestModels.cs +++ b/src/Models/LocationsRequestModels.cs @@ -4,6 +4,7 @@ namespace Berufsschule_HAM.Models; public class LocationsCreateRequestModel { + [JsonPropertyName("Description")] public required LocationsDescription LocationsDescription { get; set; } } diff --git a/src/Resources/Views.Home.Locations.de.resx b/src/Resources/Views.Home.Locations.de.resx index 823228c..c8db175 100644 --- a/src/Resources/Views.Home.Locations.de.resx +++ b/src/Resources/Views.Home.Locations.de.resx @@ -19,4 +19,46 @@ Ort anlegen + + Ort ID + + + Ort Name + + + Raumnummer + + + Sitz + + + Aktion + + + Anpassen + + + Löschen + + + Ort erfolgreich gelöscht + + + Unbekannter Fehler + + + Server konnte nicht erreicht werden + + + Ort wurde erfolgreich angepasst + + + Ort konnte nicht angepasst werden + + + Ort wurde erfolgreich erstellt + + + Erstellung des Ortes ist fehlgeschlagen + diff --git a/src/Views/Home/Locations.cshtml b/src/Views/Home/Locations.cshtml index bf4c5ee..73ddb16 100644 --- a/src/Views/Home/Locations.cshtml +++ b/src/Views/Home/Locations.cshtml @@ -12,7 +12,7 @@
- +
@@ -20,11 +20,11 @@ - - - - - + + + + + @@ -45,13 +45,13 @@ data-seat="@locationTableViewModel.Seat" data-bs-toggle="modal" data-bs-target="#editModal"> - Edit + @T["Edit"] @@ -161,41 +161,15 @@ row.classList.add('table-danger'); setTimeout(() => row.remove(), 300); - showToast('Location deleted successfully', 'success'); + showToast('@T["Location deleted successfully"]', 'success'); } else { - showToast(`❌ ${result.reason}: ${result.exception || 'Unknown error'}`, 'danger'); + showToast(`${result.reason}: ${result.exception || '@T["Unknown error"]'}`, 'danger'); } } catch (error) { console.error(error); - showToast('Error contacting server', 'danger'); + showToast('@T["Error contacting server"]', 'danger'); } }); - - // Simple toast helper - function showToast(message, type) { - const toastContainer = document.getElementById('toastContainer') || createToastContainer(); - const toast = document.createElement('div'); - toast.className = `toast align-items-center text-white bg-${type} border-0`; - toast.role = 'alert'; - toast.innerHTML = ` -
-
${message}
- -
- `; - toastContainer.appendChild(toast); - const bsToast = new bootstrap.Toast(toast, { delay: 3000 }); - bsToast.show(); - toast.addEventListener('hidden.bs.toast', () => toast.remove()); - } - - function createToastContainer() { - const container = document.createElement('div'); - container.id = 'toastContainer'; - container.className = 'toast-container position-fixed bottom-0 end-0 p-3'; - document.body.appendChild(container); - return container; - } }); @@ -299,13 +273,130 @@ // Close modal bootstrap.Modal.getInstance(editModal).hide(); - showToast('Location updated successfully', 'success'); + showToast('@T["Location updated successfully"]', 'success'); } else { - showToast(`${result.reason || 'Update failed'}`, 'danger'); + showToast(`${result.reason || '@T["Location update failed"]'}`, 'danger'); } } catch (error) { console.error(error); - showToast('Error contacting server', 'danger'); + showToast('@T["Error contacting server"]', 'danger'); + } + }); + }); + + + + + +
UserAsset IDAsset NameLocationAction@T["Location ID"]@T["Location name"]@T["Room number"]@T["Seat"]@T["Action"]