36 lines
943 B
C#
36 lines
943 B
C#
using Core.Abstractions.Models;
|
|
using Core.DomainObjects;
|
|
using Core.Enumerations;
|
|
using WeatherForecast.Models.L10n;
|
|
|
|
namespace WeatherForecast.Models.Responses {
|
|
public class GetCategoryItemResponseModel : ResponseModelBase {
|
|
public Guid Id { get; set; }
|
|
public Guid SiteId { get; set; }
|
|
public string? Slug { get; set; }
|
|
public string? Text { get; set; }
|
|
|
|
public List<CategoryL10nModel>? L10n { get; set; }
|
|
|
|
|
|
|
|
public GetCategoryItemResponseModel(Category category) {
|
|
Id = category.Id;
|
|
SiteId = category.SiteId;
|
|
|
|
L10n = category.L10n.Select(x => new CategoryL10nModel(x)).ToList();
|
|
}
|
|
|
|
public GetCategoryItemResponseModel(Category category, Locales locale) {
|
|
Id = category.Id;
|
|
SiteId = category.SiteId;
|
|
|
|
var l10n = category.L10n.SingleOrDefault(x => x.Locale == locale);
|
|
if (l10n != null) {
|
|
Slug = l10n.Slug;
|
|
Text = l10n.Text;
|
|
}
|
|
}
|
|
}
|
|
}
|