2025-03-19 08:57:29 +01:00

65 lines
1.9 KiB
C#

using Manager.DTOs;
using ManagerService.DTOs;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace ManagerService.Data.SubSection
{
/// <summary>
/// Section quiz
/// </summary>
public class SectionQuiz : Section
{
[Required]
public List<QuizQuestion> Questions { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<TranslationAndResource> BadLevel { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<TranslationAndResource> MediumLevel { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<TranslationAndResource> GoodLevel { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<TranslationAndResource> GreatLevel { get; set; }
public QuizDTO ToDTO()
{
return new QuizDTO()
{
id = Id,
label = Label,
title = Title.OrderBy(t => t.Language).Select(l => l.ToDTO()).ToList(),
description = Description.OrderBy(d => d.Language).Select(l => l.ToDTO()).ToList(),
order = Order,
type = Type,
imageId = ImageId,
imageSource = ImageSource,
configurationId = ConfigurationId,
isSubSection = IsSubSection,
parentId = ParentId,
dateCreation = DateCreation,
instanceId = InstanceId,
isBeacon = IsBeacon,
beaconId = BeaconId,
latitude = Latitude,
longitude = Longitude,
meterZoneGPS = MeterZoneGPS,
//questions = Questions.Select(q => q.tod)
// TODO
};
}
}
}