mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 23:11:54 +00:00
36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
namespace Berufsschule_HAM.Models;
|
|
|
|
using System.Text.Json;
|
|
using Berufsschule_HAM.Exceptions;
|
|
public class LocationModel
|
|
{
|
|
public required string Location { get; set; }
|
|
public LocationsDescription? Description { get; set; }
|
|
public LocationModel(Dictionary<string, string> ldapData)
|
|
{
|
|
Location = ldapData.GetValueOrDefault("l") ?? throw new LocationModelConfigurationException();
|
|
string? descriptionValue = ldapData.GetValueOrDefault("description");
|
|
if (descriptionValue is null)
|
|
{
|
|
Description = new();
|
|
}
|
|
else
|
|
{
|
|
Description = JsonSerializer.Deserialize<LocationsDescription>(descriptionValue);
|
|
}
|
|
}
|
|
}
|
|
public class LocationsDescription
|
|
{
|
|
public string? Location { get; set; }
|
|
public string? RoomNumber { get; set; }
|
|
public string? Seat { get; set; }
|
|
}
|
|
|
|
public class LocationTableViewModel
|
|
{
|
|
public required string LocationID { get; set; }
|
|
public required string LocationName { get; set; }
|
|
public required string RoomNumber { get; set; }
|
|
public required string Seat { get; set; }
|
|
} |