52 lines
1.1 KiB
C#
52 lines
1.1 KiB
C#
using Core.Abstractions.Models;
|
|
|
|
using DomainObjects;
|
|
using DomainObjects.Enumerations;
|
|
|
|
namespace WeatherForecast.Models.Abstractions.PostItem.Responses {
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public class MediaAttachmentResponseModel : ResponseModelBase {
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public List<MediaAttachmentL10nModel>? L10n { get; set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string? Src { get; set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string? Alt { get; set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="image"></param>
|
|
public MediaAttachmentResponseModel(MediaAttachment image) {
|
|
L10n = image.L10n.Select(x => new MediaAttachmentL10nModel(x)).ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="mediaAttachment"></param>
|
|
/// <param name="locale"></param>
|
|
public MediaAttachmentResponseModel(MediaAttachment mediaAttachment, Locales locale) {
|
|
Src = mediaAttachment.Src;
|
|
|
|
var l10n = mediaAttachment.L10n.Single(x => x.Locale == locale);
|
|
|
|
if (l10n != null) {
|
|
Alt = l10n.Alt;
|
|
}
|
|
}
|
|
}
|
|
}
|