98 lines
2.0 KiB
C#
98 lines
2.0 KiB
C#
using Core.Abstractions;
|
|
using Core.Abstractions.Models;
|
|
using Core.DomainObjects.L10n;
|
|
using Core.Enumerations;
|
|
|
|
namespace WeatherForecast.Models.L10n {
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public class PostItemL10nModel : ModelBase {
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string Locale { get; set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string Slug { get; set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string Description { get; set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string Title { get; set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string ShortText { get; set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string Text { get; set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string PlainText { get; set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string ContentType { get; set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public List<string>? Badges { get; set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public PostItemL10nModel() { }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="postItemL10n"></param>
|
|
public PostItemL10nModel(PostItemL10n postItemL10n) {
|
|
Locale = postItemL10n.Locale.Name;
|
|
Slug = postItemL10n.Slug;
|
|
Description = postItemL10n.Description;
|
|
Title = postItemL10n.Title;
|
|
ShortText = postItemL10n.ShortText;
|
|
Text = postItemL10n.Text;
|
|
ContentType = postItemL10n.ContentType.Name;
|
|
Badges = postItemL10n.Badges;
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public PostItemL10n ToDomainObject() => new() {
|
|
Locale = Enumeration.FromDisplayName<Locales>(Locale),
|
|
Slug = Slug,
|
|
Description = Description,
|
|
Title = Title,
|
|
Text = Text,
|
|
ShortText = ShortText,
|
|
|
|
// TODO: create plain text creation logic
|
|
PlainText = "TODO",
|
|
|
|
ContentType = Enumeration.FromDisplayName<ContentTypes>(ContentType),
|
|
Badges = Badges
|
|
};
|
|
}
|
|
}
|