using Core.DomainObjects.Documents; using Core.Enumerations; using Extensions; using System.ComponentModel.DataAnnotations; using WeatherForecast.Models.Abstractions.PostItem.Requests; namespace WeatherForecast.Models.Blog.Requests { /// /// /// public class BlogItemRequestModel : PostItemRequestModelBase { /// /// /// public uint? ReadTime { get; set; } /// /// /// public uint? Likes { get; set; } /// /// /// /// public override BlogDocument ToDomainObject() { return new BlogDocument() { L10n = L10n.Select(x => x.ToDomainObject()).ToList(), // Images // Author Tags = Tags, Categories = Categories, FamilyFriendly = FamilyFriendly, ReadTime = ReadTime, Likes = Likes }; } /// /// /// /// /// public override IEnumerable Validate(ValidationContext validationContext) { if (L10n.IsNullOrEmpty()) yield return new ValidationResult($"{nameof(L10n)} {Errors.NullOrEmpty}"); if (MediaAttachments.IsNullOrEmpty()) yield return new ValidationResult($"{nameof(MediaAttachments)} {Errors.NullOrEmpty}"); } } }