reactredux/webapi/WeatherForecast/Models/Abstractions/PostItemResponseModelBase.cs

38 lines
1003 B
C#

using Core.Abstractions.DomainObjects;
using Core.Abstractions.Models;
namespace WeatherForecast.Models.Abstractions {
public abstract class PostItemResponseModelBase<T> : ResponseModelBase {
public string Slug { get; set; }
public List<ImageModel> Images { get; set; }
public List<string> Badges { get; set; }
public string Title { get; set; }
public string? ShortText { get; set; }
public string? Text { get; set; }
public AuthorModel Author { get; set; }
public DateTime Created { get; set; }
public List<string> Tags { get; set; }
public PostItemResponseModelBase(PostItemBase<T> postItem) {
Slug = postItem.Slug;
Images = postItem.Images.Select(x => new ImageModel(x)).ToList();
Badges = postItem.Badges;
Title = postItem.Title;
Text = postItem.Text;
ShortText = postItem.ShortText;
Author = new AuthorModel(postItem.Author);
Created = postItem.Created;
Tags = postItem.Tags;
}
}
}