using Core.Abstractions.Models;
using Core.DomainObjects;
using Core.Enumerations;
using Extensions;
using System.ComponentModel.DataAnnotations;
using WeatherForecast.Models.Requests.L10n;
namespace WeatherForecast.Models {
///
///
///
public class ImageRequestModel : RequestModelBase {
///
///
///
public List? L10n { get; set; }
///
///
///
public string? Src { get; set; }
///
///
///
public string? Alt { get; set; }
///
///
///
///
///
public override MediaAttachment ToDomainObject() {
throw new NotImplementedException();
}
///
///
///
///
///
///
public override IEnumerable 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}");
}
}
}