reactredux/src/WeatherForecast/Models/Content/Responses/PageSections/TestimonialsSectionModel.cs

89 lines
1.9 KiB
C#

using DomainObjects;
using DomainObjects.PageSections;
using WeatherForecast.Models.Abstractions;
namespace WeatherForecast.Models.Content.Responses.PageSections {
/// <summary>
///
/// </summary>
public class ReviewerModel {
/// <summary>
///
/// </summary>
public Guid Id { get; set; }
/// <summary>
///
/// </summary>
public MediaAttachmentResponseModel? Image { get; set; }
/// <summary>
///
/// </summary>
public string FullName { get; set; }
/// <summary>
///
/// </summary>
public string Position { get; set; }
/// <summary>
///
/// </summary>
/// <param name="reviewer"></param>
public ReviewerModel(Reviewer reviewer) {
FullName = reviewer.FullName;
Position = reviewer.Position;
if (reviewer.Image != null)
Image = new MediaAttachmentResponseModel(reviewer.Image);
}
}
/// <summary>
///
/// </summary>
public class TestimonialModel {
/// <summary>
///
/// </summary>
public string Text { get; set; }
/// <summary>
///
/// </summary>
public ReviewerModel Reviewer { get; set; }
/// <summary>
///
/// </summary>
/// <param name="testimonial"></param>
public TestimonialModel(Testimonial testimonial) {
Text = testimonial.Text;
Reviewer = new ReviewerModel(testimonial.Reviewer);
}
}
/// <summary>
///
/// </summary>
public class TestimonialsSectionModel : PageSectionModelBase<TestimonialsSection> {
/// <summary>
///
/// </summary>
public List<TestimonialModel> Items { get; set; }
/// <summary>
///
/// </summary>
/// <param name="testimonialsSection"></param>
public TestimonialsSectionModel(TestimonialsSection testimonialsSection) : base(testimonialsSection) {
Items = testimonialsSection.Items.Select(x => new TestimonialModel(x)).ToList();
}
}
}