50 lines
997 B
C#
50 lines
997 B
C#
using Core.DomainObjects;
|
|
using Core.Enumerations;
|
|
using WeatherForecast.Models.L10n;
|
|
|
|
namespace WeatherForecast.Models {
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public class ImageModel {
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public List<ImageL10nModel>? L10n { get; set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string? Src { get; set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string? Alt { get; set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="image"></param>
|
|
public ImageModel(Image image) {
|
|
L10n = image.L10n.Select(x => new ImageL10nModel(x)).ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="image"></param>
|
|
/// <param name="locale"></param>
|
|
public ImageModel(Image image, Locales locale) {
|
|
Src = image.Src;
|
|
|
|
var l10n = image.L10n.SingleOrDefault(x => x.Locale == locale);
|
|
if (l10n != null) {
|
|
Alt = l10n.Alt;
|
|
}
|
|
}
|
|
}
|
|
}
|