57 lines
1.5 KiB
C#
57 lines
1.5 KiB
C#
using Core.Abstractions.Models;
|
|
using Core.DomainObjects;
|
|
using Core.Enumerations;
|
|
using Extensions;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using WeatherForecast.Models.Requests.L10n;
|
|
|
|
namespace WeatherForecast.Models {
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public class ImageRequestModel : RequestModelBase<MediaAttachment> {
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public List<ImageL10nModel>? L10n { get; set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string? Src { get; set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string? Alt { get; set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
public override MediaAttachment ToDomainObject() {
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="validationContext"></param>
|
|
/// <returns></returns>
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
public override IEnumerable<ValidationResult> Validate(ValidationContext validationContext) {
|
|
if (L10n.IsNullOrEmpty())
|
|
yield return new ValidationResult($"{nameof(L10n)} ${Errors.NullOrEmpty}");
|
|
|
|
if (string.IsNullOrWhiteSpace(Src))
|
|
yield return new ValidationResult($"{nameof(Src)} ${Errors.NullOrWhiteSpace}");
|
|
|
|
if (string.IsNullOrWhiteSpace(Alt))
|
|
yield return new ValidationResult($"{nameof(Alt)} ${Errors.NullOrWhiteSpace}");
|
|
}
|
|
}
|
|
}
|