reactredux/webapi/WeatherForecast/Models/CategoryModel.cs

25 lines
682 B
C#

using Core.DomainObjects;
using Core.Enumerations;
using WeatherForecast.Models.L10n;
namespace WeatherForecast.Models {
public class CategoryModel {
public List<CategoryL10nModel>? L10n { get; set; }
public string? Slug { get; set; }
public string? Text { get; set; }
public CategoryModel(Category category) {
L10n = category.L10n.Select(x => new CategoryL10nModel(x)).ToList();
}
public CategoryModel(Category category, Locales locale) {
var categoryL10n = category.L10n.SingleOrDefault(x => x.Locale == locale);
if (categoryL10n != null) {
Slug = categoryL10n.Slug;
Text = categoryL10n.Text;
}
}
}
}