125 lines
3.1 KiB
C#
125 lines
3.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using gehGassi.Domain.Common;
|
|
using gehGassi.Domain.Localization;
|
|
|
|
namespace gehGassi.Domain.Pages
|
|
{
|
|
/// <summary>
|
|
/// Repräsentiert eine Text-Seite mit deren Hilfe Inhalte für z.B. FAQ, Datenschutz usw. erstellt werden können
|
|
/// </summary>
|
|
public class Page : LocalizableBase, IAuditable
|
|
{
|
|
/// <summary>
|
|
/// Eindeutige Id
|
|
/// </summary>
|
|
[Key]
|
|
[Required]
|
|
public int Id { get; set; }
|
|
|
|
/// <summary>
|
|
/// Titel der Seite
|
|
/// </summary>
|
|
[Required]
|
|
[MaxLength(100)]
|
|
public string Title { get; set; }
|
|
|
|
/// <summary>
|
|
/// Eindeutiger Code für die Seite.
|
|
/// Wird für den Aufruf aus der App verwendet
|
|
/// </summary>
|
|
[Required]
|
|
[MaxLength(20)]
|
|
public string Code { get; set; }
|
|
|
|
#region Inhalt
|
|
|
|
/// <summary>
|
|
/// Inhalt - HTML
|
|
/// </summary>
|
|
[Localized]
|
|
[NotMapped]
|
|
public string Content
|
|
{
|
|
get => Get("Content", GetLanguage());
|
|
set => Set("Content", GetLanguage(), value);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Inhalt - HTML
|
|
/// </summary>
|
|
public string ContentLocalized { get; set; }
|
|
|
|
#endregion
|
|
|
|
#region IAuditable
|
|
/// <summary>
|
|
/// Gibt den eindeutigen Key für die Entität zurück;
|
|
/// Hier als String gelöst, weil damit auch kombinierte Schlüssel möglich sind.
|
|
/// </summary>
|
|
/// <returns>Eindeutiger Key</returns>
|
|
public string AuditKey()
|
|
{
|
|
return Id.ToString();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gibt den Objektnamen bzw. die Tabelle der Entität zurück
|
|
/// </summary>
|
|
/// <returns>Objektnamen</returns>
|
|
public string AuditTable()
|
|
{
|
|
return "Pages";
|
|
}
|
|
|
|
public AuditableOptions Options()
|
|
{
|
|
return AuditableOptions.Create | AuditableOptions.Edit | AuditableOptions.Delete;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
/// <summary>
|
|
/// Text-Seite für die Listendarstellung
|
|
/// </summary>
|
|
public class PageWithNames: LocalizableBase
|
|
{
|
|
/// <summary>
|
|
/// Eindeutige Id
|
|
/// </summary>
|
|
public int Id { get; set; }
|
|
|
|
/// <summary>
|
|
/// Titel der Seite
|
|
/// </summary>
|
|
public string Title { get; set; }
|
|
|
|
/// <summary>
|
|
/// Eindeutiger Code für die Seite.
|
|
/// Wird für den Aufruf aus der App verwendet
|
|
/// </summary>
|
|
public string Code { get; set; }
|
|
|
|
/// <summary>
|
|
/// Inhalt - HTML
|
|
/// </summary>
|
|
[Localized]
|
|
public string Content
|
|
{
|
|
get => Get("Content", GetLanguage());
|
|
set => Set("Content", GetLanguage(), value);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Inhalt Übersetzung
|
|
/// </summary>
|
|
public string ContentLocalized { get; set; }
|
|
}
|
|
}
|