49 lines
1.0 KiB
C#
49 lines
1.0 KiB
C#
using Core.DomainObjects;
|
|
using Core.Enumerations;
|
|
using WeatherForecast.Models.L10n;
|
|
|
|
namespace WeatherForecast.Models {
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public class CategoryModel {
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public List<CategoryL10nModel>? L10n { get; set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string? Slug { get; set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string? Text { get; set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="category"></param>
|
|
public CategoryModel(Category category) {
|
|
L10n = category.L10n.Select(x => new CategoryL10nModel(x)).ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="category"></param>
|
|
/// <param name="locale"></param>
|
|
public CategoryModel(Category category, Locales locale) {
|
|
var categoryL10n = category.L10n.SingleOrDefault(x => x.Locale == locale);
|
|
if (categoryL10n != null) {
|
|
Slug = categoryL10n.Slug;
|
|
Text = categoryL10n.Text;
|
|
}
|
|
}
|
|
}
|
|
}
|