668 lines
30 KiB
C#
668 lines
30 KiB
C#
using Manager.DTOs;
|
|
using ManagerService.Data;
|
|
using ManagerService.Data.SubSection;
|
|
using ManagerService.DTOs;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Text.Json;
|
|
|
|
namespace ManagerService.Services
|
|
{
|
|
public static class SectionFactory
|
|
{
|
|
public static Section Create(JsonElement jsonElement, SectionDTO dto)
|
|
{
|
|
AgendaDTO agendaDTO = new AgendaDTO();
|
|
ArticleDTO articleDTO = new ArticleDTO();
|
|
SectionEventDTO sectionEventDTO = new SectionEventDTO();
|
|
MapDTO mapDTO = new MapDTO();
|
|
MenuDTO menuDTO = new MenuDTO();
|
|
PdfDTO pdfDTO = new PdfDTO();
|
|
GameDTO puzzleDTO = new GameDTO();
|
|
QuizDTO quizDTO = new QuizDTO();
|
|
SliderDTO sliderDTO = new SliderDTO();
|
|
VideoDTO videoDTO = new VideoDTO();
|
|
WeatherDTO weatherDTO = new WeatherDTO();
|
|
WebDTO webDTO = new WebDTO();
|
|
|
|
switch (dto.type)
|
|
{
|
|
case SectionType.Agenda:
|
|
agendaDTO = JsonConvert.DeserializeObject<AgendaDTO>(jsonElement.ToString());
|
|
break;
|
|
case SectionType.Article:
|
|
articleDTO = JsonConvert.DeserializeObject<ArticleDTO>(jsonElement.ToString());
|
|
break;
|
|
case SectionType.Event:
|
|
sectionEventDTO = JsonConvert.DeserializeObject<SectionEventDTO>(jsonElement.ToString());
|
|
break;
|
|
case SectionType.Map:
|
|
mapDTO = JsonConvert.DeserializeObject<MapDTO>(jsonElement.ToString());
|
|
break;
|
|
case SectionType.Menu:
|
|
menuDTO = JsonConvert.DeserializeObject<MenuDTO>(jsonElement.ToString());
|
|
break;
|
|
case SectionType.PDF:
|
|
pdfDTO = JsonConvert.DeserializeObject<PdfDTO>(jsonElement.ToString());
|
|
break;
|
|
case SectionType.Game:
|
|
puzzleDTO = JsonConvert.DeserializeObject<GameDTO>(jsonElement.ToString());
|
|
break;
|
|
case SectionType.Quiz:
|
|
quizDTO = JsonConvert.DeserializeObject<QuizDTO>(jsonElement.ToString());
|
|
break;
|
|
case SectionType.Slider:
|
|
sliderDTO = JsonConvert.DeserializeObject<SliderDTO>(jsonElement.ToString());
|
|
break;
|
|
case SectionType.Video:
|
|
videoDTO = JsonConvert.DeserializeObject<VideoDTO>(jsonElement.ToString());
|
|
break;
|
|
case SectionType.Weather:
|
|
weatherDTO = JsonConvert.DeserializeObject<WeatherDTO>(jsonElement.ToString());
|
|
break;
|
|
case SectionType.Web:
|
|
webDTO = JsonConvert.DeserializeObject<WebDTO>(jsonElement.ToString());
|
|
break;
|
|
}
|
|
|
|
return dto.type switch
|
|
{
|
|
SectionType.Agenda => new SectionAgenda
|
|
{
|
|
Id = dto.id,
|
|
DateCreation = dto.dateCreation.Value,
|
|
ConfigurationId = dto.configurationId,
|
|
InstanceId = dto.instanceId,
|
|
Label = dto.label,
|
|
Title = dto.title,
|
|
Description = dto.description,
|
|
Order = dto.order.Value,
|
|
ImageId = dto.imageId,
|
|
ImageSource = dto.imageSource,
|
|
IsSubSection = dto.isSubSection,
|
|
ParentId = dto.parentId,
|
|
IsBeacon = dto.isBeacon,
|
|
BeaconId = dto.beaconId,
|
|
Latitude = dto.latitude,
|
|
Longitude = dto.longitude,
|
|
MeterZoneGPS = dto.meterZoneGPS,
|
|
Type = dto.type,
|
|
AgendaResourceIds = agendaDTO.resourceIds,
|
|
AgendaMapProvider = agendaDTO.agendaMapProvider,
|
|
//EventAgendas = // TODO specific
|
|
},
|
|
SectionType.Article => new SectionArticle
|
|
{
|
|
Id = dto.id,
|
|
DateCreation = dto.dateCreation.Value,
|
|
ConfigurationId = dto.configurationId,
|
|
InstanceId = dto.instanceId,
|
|
Label = dto.label,
|
|
Title = dto.title,
|
|
Description = dto.description,
|
|
Order = dto.order.Value,
|
|
ImageId = dto.imageId,
|
|
ImageSource = dto.imageSource,
|
|
IsSubSection = dto.isSubSection,
|
|
ParentId = dto.parentId,
|
|
IsBeacon = dto.isBeacon,
|
|
BeaconId = dto.beaconId,
|
|
Latitude = dto.latitude,
|
|
Longitude = dto.longitude,
|
|
MeterZoneGPS = dto.meterZoneGPS,
|
|
Type = dto.type,
|
|
ArticleContent = articleDTO.content,
|
|
ArticleIsContentTop = articleDTO.isContentTop,
|
|
ArticleAudioIds = articleDTO.audioIds,
|
|
ArticleIsReadAudioAuto = articleDTO.isReadAudioAuto,
|
|
ArticleContents = articleDTO.contents
|
|
},
|
|
SectionType.Event => new SectionEvent
|
|
{
|
|
Id = dto.id,
|
|
DateCreation = dto.dateCreation.Value,
|
|
ConfigurationId = dto.configurationId,
|
|
InstanceId = dto.instanceId,
|
|
Label = dto.label,
|
|
Title = dto.title,
|
|
Description = dto.description,
|
|
Order = dto.order.Value,
|
|
ImageId = dto.imageId,
|
|
ImageSource = dto.imageSource,
|
|
IsSubSection = dto.isSubSection,
|
|
ParentId = dto.parentId,
|
|
IsBeacon = dto.isBeacon,
|
|
BeaconId = dto.beaconId,
|
|
Latitude = dto.latitude,
|
|
Longitude = dto.longitude,
|
|
MeterZoneGPS = dto.meterZoneGPS,
|
|
Type = dto.type,
|
|
StartDate = sectionEventDTO.StartDate,
|
|
EndDate = sectionEventDTO.EndDate,
|
|
ParcoursIds = sectionEventDTO.ParcoursIds,
|
|
//Programmes = // TODO specific
|
|
},
|
|
SectionType.Map => new SectionMap
|
|
{
|
|
Id = dto.id,
|
|
DateCreation = dto.dateCreation.Value,
|
|
ConfigurationId = dto.configurationId,
|
|
InstanceId = dto.instanceId,
|
|
Label = dto.label,
|
|
Title = dto.title,
|
|
Description = dto.description,
|
|
Order = dto.order.Value,
|
|
ImageId = dto.imageId,
|
|
ImageSource = dto.imageSource,
|
|
IsSubSection = dto.isSubSection,
|
|
ParentId = dto.parentId,
|
|
IsBeacon = dto.isBeacon,
|
|
BeaconId = dto.beaconId,
|
|
Latitude = dto.latitude,
|
|
Longitude = dto.longitude,
|
|
MeterZoneGPS = dto.meterZoneGPS,
|
|
Type = dto.type,
|
|
MapZoom = mapDTO.zoom,
|
|
MapMapType = mapDTO.mapType,
|
|
MapTypeMapbox = mapDTO.mapTypeMapbox,
|
|
MapMapProvider = mapDTO.mapProvider,
|
|
MapResourceId = mapDTO.iconResourceId,
|
|
MapCenterLatitude = mapDTO.centerLatitude,
|
|
MapCenterLongitude = mapDTO.centerLongitude,
|
|
MapCategories = mapDTO.categories
|
|
},
|
|
SectionType.Menu => new SectionMenu
|
|
{
|
|
Id = dto.id,
|
|
DateCreation = dto.dateCreation.Value,
|
|
ConfigurationId = dto.configurationId,
|
|
InstanceId = dto.instanceId,
|
|
Label = dto.label,
|
|
Title = dto.title,
|
|
Description = dto.description,
|
|
Order = dto.order.Value,
|
|
ImageId = dto.imageId,
|
|
ImageSource = dto.imageSource,
|
|
IsSubSection = dto.isSubSection,
|
|
ParentId = dto.parentId,
|
|
IsBeacon = dto.isBeacon,
|
|
BeaconId = dto.beaconId,
|
|
Latitude = dto.latitude,
|
|
Longitude = dto.longitude,
|
|
MeterZoneGPS = dto.meterZoneGPS,
|
|
Type = dto.type,
|
|
//Sections = ((MenuDTO)dto).sections, // TODO specific
|
|
},
|
|
SectionType.PDF => new SectionPdf
|
|
{
|
|
Id = dto.id,
|
|
DateCreation = dto.dateCreation.Value,
|
|
ConfigurationId = dto.configurationId,
|
|
InstanceId = dto.instanceId,
|
|
Label = dto.label,
|
|
Title = dto.title,
|
|
Description = dto.description,
|
|
Order = dto.order.Value,
|
|
ImageId = dto.imageId,
|
|
ImageSource = dto.imageSource,
|
|
IsSubSection = dto.isSubSection,
|
|
ParentId = dto.parentId,
|
|
IsBeacon = dto.isBeacon,
|
|
BeaconId = dto.beaconId,
|
|
Latitude = dto.latitude,
|
|
Longitude = dto.longitude,
|
|
MeterZoneGPS = dto.meterZoneGPS,
|
|
Type = dto.type,
|
|
PDFOrderedTranslationAndResources = pdfDTO.pdfs
|
|
},
|
|
SectionType.Game => new SectionGame
|
|
{
|
|
Id = dto.id,
|
|
DateCreation = dto.dateCreation.Value,
|
|
ConfigurationId = dto.configurationId,
|
|
InstanceId = dto.instanceId,
|
|
Label = dto.label,
|
|
Title = dto.title,
|
|
Description = dto.description,
|
|
Order = dto.order.Value,
|
|
ImageId = dto.imageId,
|
|
ImageSource = dto.imageSource,
|
|
IsSubSection = dto.isSubSection,
|
|
ParentId = dto.parentId,
|
|
IsBeacon = dto.isBeacon,
|
|
BeaconId = dto.beaconId,
|
|
Latitude = dto.latitude,
|
|
Longitude = dto.longitude,
|
|
MeterZoneGPS = dto.meterZoneGPS,
|
|
Type = dto.type,
|
|
GameMessageDebut = puzzleDTO.messageDebut,
|
|
GameMessageFin = puzzleDTO.messageFin,
|
|
GamePuzzleImageId = puzzleDTO.puzzleImageId,
|
|
GamePuzzleRows = puzzleDTO.rows,
|
|
GamePuzzleCols = puzzleDTO.cols
|
|
},
|
|
SectionType.Quiz => new SectionQuiz
|
|
{
|
|
Id = dto.id,
|
|
DateCreation = dto.dateCreation.Value,
|
|
ConfigurationId = dto.configurationId,
|
|
InstanceId = dto.instanceId,
|
|
Label = dto.label,
|
|
Title = dto.title,
|
|
Description = dto.description,
|
|
Order = dto.order.Value,
|
|
ImageId = dto.imageId,
|
|
ImageSource = dto.imageSource,
|
|
IsSubSection = dto.isSubSection,
|
|
ParentId = dto.parentId,
|
|
IsBeacon = dto.isBeacon,
|
|
BeaconId = dto.beaconId,
|
|
Latitude = dto.latitude,
|
|
Longitude = dto.longitude,
|
|
MeterZoneGPS = dto.meterZoneGPS,
|
|
Type = dto.type,
|
|
QuizBadLevel = quizDTO.bad_level,
|
|
QuizMediumLevel = quizDTO.medium_level,
|
|
QuizGoodLevel = quizDTO.good_level,
|
|
QuizGreatLevel = quizDTO.great_level,
|
|
//Questions = ((QuizDTO)dto).questions, // TODO specific
|
|
},
|
|
SectionType.Slider => new SectionSlider
|
|
{
|
|
Id = dto.id,
|
|
DateCreation = dto.dateCreation.Value,
|
|
ConfigurationId = dto.configurationId,
|
|
InstanceId = dto.instanceId,
|
|
Label = dto.label,
|
|
Title = dto.title,
|
|
Description = dto.description,
|
|
Order = dto.order.Value,
|
|
ImageId = dto.imageId,
|
|
ImageSource = dto.imageSource,
|
|
IsSubSection = dto.isSubSection,
|
|
ParentId = dto.parentId,
|
|
IsBeacon = dto.isBeacon,
|
|
BeaconId = dto.beaconId,
|
|
Latitude = dto.latitude,
|
|
Longitude = dto.longitude,
|
|
MeterZoneGPS = dto.meterZoneGPS,
|
|
Type = dto.type,
|
|
SliderContents = sliderDTO.contents, // TODO TEST
|
|
},
|
|
SectionType.Video => new SectionVideo
|
|
{
|
|
Id = dto.id,
|
|
DateCreation = dto.dateCreation.Value,
|
|
ConfigurationId = dto.configurationId,
|
|
InstanceId = dto.instanceId,
|
|
Label = dto.label,
|
|
Title = dto.title,
|
|
Description = dto.description,
|
|
Order = dto.order.Value,
|
|
ImageId = dto.imageId,
|
|
ImageSource = dto.imageSource,
|
|
IsSubSection = dto.isSubSection,
|
|
ParentId = dto.parentId,
|
|
IsBeacon = dto.isBeacon,
|
|
BeaconId = dto.beaconId,
|
|
Latitude = dto.latitude,
|
|
Longitude = dto.longitude,
|
|
MeterZoneGPS = dto.meterZoneGPS,
|
|
Type = dto.type,
|
|
VideoSource = videoDTO.source,
|
|
},
|
|
|
|
SectionType.Weather => new SectionWeather
|
|
{
|
|
Id = dto.id,
|
|
DateCreation = dto.dateCreation.Value,
|
|
ConfigurationId = dto.configurationId,
|
|
InstanceId = dto.instanceId,
|
|
Label = dto.label,
|
|
Title = dto.title,
|
|
Description = dto.description,
|
|
Order = dto.order.Value,
|
|
ImageId = dto.imageId,
|
|
ImageSource = dto.imageSource,
|
|
IsSubSection = dto.isSubSection,
|
|
ParentId = dto.parentId,
|
|
IsBeacon = dto.isBeacon,
|
|
BeaconId = dto.beaconId,
|
|
Latitude = dto.latitude,
|
|
Longitude = dto.longitude,
|
|
MeterZoneGPS = dto.meterZoneGPS,
|
|
Type = dto.type,
|
|
WeatherCity = weatherDTO.city,
|
|
WeatherUpdatedDate = weatherDTO.updatedDate,
|
|
WeatherResult = weatherDTO.result
|
|
},
|
|
SectionType.Web => new SectionWeb
|
|
{
|
|
Id = dto.id,
|
|
DateCreation = dto.dateCreation.Value,
|
|
ConfigurationId = dto.configurationId,
|
|
InstanceId = dto.instanceId,
|
|
Label = dto.label,
|
|
Title = dto.title,
|
|
Description = dto.description,
|
|
Order = dto.order.Value,
|
|
ImageId = dto.imageId,
|
|
ImageSource = dto.imageSource,
|
|
IsSubSection = dto.isSubSection,
|
|
ParentId = dto.parentId,
|
|
IsBeacon = dto.isBeacon,
|
|
BeaconId = dto.beaconId,
|
|
Latitude = dto.latitude,
|
|
Longitude = dto.longitude,
|
|
MeterZoneGPS = dto.meterZoneGPS,
|
|
Type = dto.type,
|
|
WebSource = webDTO.source,
|
|
},
|
|
_ => throw new NotImplementedException("Section type not handled")
|
|
};
|
|
}
|
|
|
|
public static object ToDTO(Section section)
|
|
{
|
|
// TODO retrieve specific elements ?
|
|
return section switch
|
|
{
|
|
SectionAgenda agenda => new AgendaDTO
|
|
{
|
|
id = agenda.Id,
|
|
dateCreation = agenda.DateCreation,
|
|
configurationId = agenda.ConfigurationId,
|
|
instanceId = agenda.InstanceId,
|
|
label = agenda.Label,
|
|
title = agenda.Title,
|
|
description = agenda.Description,
|
|
order = agenda.Order,
|
|
imageId = agenda.ImageId,
|
|
imageSource = agenda.ImageSource,
|
|
isSubSection = agenda.IsSubSection,
|
|
parentId = agenda.ParentId,
|
|
isBeacon = agenda.IsBeacon,
|
|
beaconId = agenda.BeaconId,
|
|
latitude = agenda.Latitude,
|
|
longitude = agenda.Longitude,
|
|
meterZoneGPS = agenda.MeterZoneGPS,
|
|
type = agenda.Type,
|
|
resourceIds = agenda.AgendaResourceIds,
|
|
agendaMapProvider = agenda.AgendaMapProvider,
|
|
// events => TODO specific
|
|
},
|
|
SectionArticle article => new ArticleDTO
|
|
{
|
|
id = article.Id,
|
|
dateCreation = article.DateCreation,
|
|
configurationId = article.ConfigurationId,
|
|
instanceId = article.InstanceId,
|
|
label = article.Label,
|
|
title = article.Title,
|
|
description = article.Description,
|
|
order = article.Order,
|
|
imageId = article.ImageId,
|
|
imageSource = article.ImageSource,
|
|
isSubSection = article.IsSubSection,
|
|
parentId = article.ParentId,
|
|
isBeacon = article.IsBeacon,
|
|
beaconId = article.BeaconId,
|
|
latitude = article.Latitude,
|
|
longitude = article.Longitude,
|
|
meterZoneGPS = article.MeterZoneGPS,
|
|
type = article.Type,
|
|
content = article.ArticleContent,
|
|
isContentTop = article.ArticleIsContentTop,
|
|
audioIds = article.ArticleAudioIds,
|
|
isReadAudioAuto = article.ArticleIsReadAudioAuto,
|
|
contents = article.ArticleContents
|
|
},
|
|
SectionEvent sectionEvent => new SectionEventDTO
|
|
{
|
|
id = sectionEvent.Id,
|
|
dateCreation = sectionEvent.DateCreation,
|
|
configurationId = sectionEvent.ConfigurationId,
|
|
instanceId = sectionEvent.InstanceId,
|
|
label = sectionEvent.Label,
|
|
title = sectionEvent.Title,
|
|
description = sectionEvent.Description,
|
|
order = sectionEvent.Order,
|
|
imageId = sectionEvent.ImageId,
|
|
imageSource = sectionEvent.ImageSource,
|
|
isSubSection = sectionEvent.IsSubSection,
|
|
parentId = sectionEvent.ParentId,
|
|
isBeacon = sectionEvent.IsBeacon,
|
|
beaconId = sectionEvent.BeaconId,
|
|
latitude = sectionEvent.Latitude,
|
|
longitude = sectionEvent.Longitude,
|
|
meterZoneGPS = sectionEvent.MeterZoneGPS,
|
|
type = sectionEvent.Type,
|
|
StartDate = sectionEvent.StartDate,
|
|
EndDate = sectionEvent.EndDate,
|
|
ParcoursIds = sectionEvent.ParcoursIds,
|
|
// Programme TODO specific
|
|
},
|
|
SectionMap map => new MapDTO
|
|
{
|
|
id = map.Id,
|
|
dateCreation = map.DateCreation,
|
|
configurationId = map.ConfigurationId,
|
|
instanceId = map.InstanceId,
|
|
label = map.Label,
|
|
title = map.Title,
|
|
description = map.Description,
|
|
order = map.Order,
|
|
imageId = map.ImageId,
|
|
imageSource = map.ImageSource,
|
|
isSubSection = map.IsSubSection,
|
|
parentId = map.ParentId,
|
|
isBeacon = map.IsBeacon,
|
|
beaconId = map.BeaconId,
|
|
latitude = map.Latitude,
|
|
longitude = map.Longitude,
|
|
meterZoneGPS = map.MeterZoneGPS,
|
|
type = map.Type,
|
|
zoom = map.MapZoom,
|
|
mapType = map.MapMapType,
|
|
mapTypeMapbox = map.MapTypeMapbox,
|
|
mapProvider = map.MapMapProvider,
|
|
iconResourceId = map.MapResourceId,
|
|
centerLatitude = map.MapCenterLatitude,
|
|
centerLongitude = map.MapCenterLongitude,
|
|
categories = map.MapCategories,
|
|
//points = null // map.MapPoints // TODO specific
|
|
},
|
|
SectionMenu menu => new MenuDTO
|
|
{
|
|
id = menu.Id,
|
|
dateCreation = menu.DateCreation,
|
|
configurationId = menu.ConfigurationId,
|
|
instanceId = menu.InstanceId,
|
|
label = menu.Label,
|
|
title = menu.Title,
|
|
description = menu.Description,
|
|
order = menu.Order,
|
|
imageId = menu.ImageId,
|
|
imageSource = menu.ImageSource,
|
|
isSubSection = menu.IsSubSection,
|
|
parentId = menu.ParentId,
|
|
isBeacon = menu.IsBeacon,
|
|
beaconId = menu.BeaconId,
|
|
latitude = menu.Latitude,
|
|
longitude = menu.Longitude,
|
|
meterZoneGPS = menu.MeterZoneGPS,
|
|
type = menu.Type,
|
|
sections = null // menu.Sections, // TODO specific
|
|
},
|
|
SectionPdf pdf => new PdfDTO
|
|
{
|
|
id = pdf.Id,
|
|
dateCreation = pdf.DateCreation,
|
|
configurationId = pdf.ConfigurationId,
|
|
instanceId = pdf.InstanceId,
|
|
label = pdf.Label,
|
|
title = pdf.Title,
|
|
description = pdf.Description,
|
|
order = pdf.Order,
|
|
imageId = pdf.ImageId,
|
|
imageSource = pdf.ImageSource,
|
|
isSubSection = pdf.IsSubSection,
|
|
parentId = pdf.ParentId,
|
|
isBeacon = pdf.IsBeacon,
|
|
beaconId = pdf.BeaconId,
|
|
latitude = pdf.Latitude,
|
|
longitude = pdf.Longitude,
|
|
meterZoneGPS = pdf.MeterZoneGPS,
|
|
type = pdf.Type,
|
|
pdfs = pdf.PDFOrderedTranslationAndResources
|
|
},
|
|
SectionGame game => new GameDTO
|
|
{
|
|
id = game.Id,
|
|
dateCreation = game.DateCreation,
|
|
configurationId = game.ConfigurationId,
|
|
instanceId = game.InstanceId,
|
|
label = game.Label,
|
|
title = game.Title,
|
|
description = game.Description,
|
|
order = game.Order,
|
|
imageId = game.ImageId,
|
|
imageSource = game.ImageSource,
|
|
isSubSection = game.IsSubSection,
|
|
parentId = game.ParentId,
|
|
isBeacon = game.IsBeacon,
|
|
beaconId = game.BeaconId,
|
|
latitude = game.Latitude,
|
|
longitude = game.Longitude,
|
|
meterZoneGPS = game.MeterZoneGPS,
|
|
type = game.Type,
|
|
messageDebut = game.GameMessageDebut,
|
|
messageFin = game.GameMessageFin,
|
|
puzzleImage = game.GamePuzzleImage?.ToDTO(),
|
|
puzzleImageId = game.GamePuzzleImageId,
|
|
rows = game.GamePuzzleRows,
|
|
cols = game.GamePuzzleCols
|
|
},
|
|
SectionQuiz quiz => new QuizDTO
|
|
{
|
|
id = quiz.Id,
|
|
dateCreation = quiz.DateCreation,
|
|
configurationId = quiz.ConfigurationId,
|
|
instanceId = quiz.InstanceId,
|
|
label = quiz.Label,
|
|
title = quiz.Title,
|
|
description = quiz.Description,
|
|
order = quiz.Order,
|
|
imageId = quiz.ImageId,
|
|
imageSource = quiz.ImageSource,
|
|
isSubSection = quiz.IsSubSection,
|
|
parentId = quiz.ParentId,
|
|
isBeacon = quiz.IsBeacon,
|
|
beaconId = quiz.BeaconId,
|
|
latitude = quiz.Latitude,
|
|
longitude = quiz.Longitude,
|
|
meterZoneGPS = quiz.MeterZoneGPS,
|
|
type = quiz.Type,
|
|
bad_level = quiz.QuizBadLevel,
|
|
medium_level = quiz.QuizMediumLevel,
|
|
good_level = quiz.QuizGoodLevel,
|
|
great_level = quiz.QuizGreatLevel,
|
|
questions = null // quiz.Questions, // TODO specific
|
|
},
|
|
SectionSlider slider => new SliderDTO
|
|
{
|
|
id = slider.Id,
|
|
dateCreation = slider.DateCreation,
|
|
configurationId = slider.ConfigurationId,
|
|
instanceId = slider.InstanceId,
|
|
label = slider.Label,
|
|
title = slider.Title,
|
|
description = slider.Description,
|
|
order = slider.Order,
|
|
imageId = slider.ImageId,
|
|
imageSource = slider.ImageSource,
|
|
isSubSection = slider.IsSubSection,
|
|
parentId = slider.ParentId,
|
|
isBeacon = slider.IsBeacon,
|
|
beaconId = slider.BeaconId,
|
|
latitude = slider.Latitude,
|
|
longitude = slider.Longitude,
|
|
meterZoneGPS = slider.MeterZoneGPS,
|
|
type = slider.Type,
|
|
contents = slider.SliderContents
|
|
},
|
|
SectionVideo video => new VideoDTO
|
|
{
|
|
id = video.Id,
|
|
dateCreation = video.DateCreation,
|
|
configurationId = video.ConfigurationId,
|
|
instanceId = video.InstanceId,
|
|
label = video.Label,
|
|
title = video.Title,
|
|
description = video.Description,
|
|
order = video.Order,
|
|
imageId = video.ImageId,
|
|
imageSource = video.ImageSource,
|
|
isSubSection = video.IsSubSection,
|
|
parentId = video.ParentId,
|
|
isBeacon = video.IsBeacon,
|
|
beaconId = video.BeaconId,
|
|
latitude = video.Latitude,
|
|
longitude = video.Longitude,
|
|
meterZoneGPS = video.MeterZoneGPS,
|
|
type = video.Type,
|
|
source = video.VideoSource
|
|
},
|
|
SectionWeather weather => new WeatherDTO
|
|
{
|
|
id = weather.Id,
|
|
dateCreation = weather.DateCreation,
|
|
configurationId = weather.ConfigurationId,
|
|
instanceId = weather.InstanceId,
|
|
label = weather.Label,
|
|
title = weather.Title,
|
|
description = weather.Description,
|
|
order = weather.Order,
|
|
imageId = weather.ImageId,
|
|
imageSource = weather.ImageSource,
|
|
isSubSection = weather.IsSubSection,
|
|
parentId = weather.ParentId,
|
|
isBeacon = weather.IsBeacon,
|
|
beaconId = weather.BeaconId,
|
|
latitude = weather.Latitude,
|
|
longitude = weather.Longitude,
|
|
meterZoneGPS = weather.MeterZoneGPS,
|
|
type = weather.Type,
|
|
city = weather.WeatherCity,
|
|
updatedDate = weather.WeatherUpdatedDate,
|
|
result = weather.WeatherResult
|
|
},
|
|
SectionWeb web => new WebDTO
|
|
{
|
|
id = web.Id,
|
|
dateCreation = web.DateCreation,
|
|
configurationId = web.ConfigurationId,
|
|
instanceId = web.InstanceId,
|
|
label = web.Label,
|
|
title = web.Title,
|
|
description = web.Description,
|
|
order = web.Order,
|
|
imageId = web.ImageId,
|
|
imageSource = web.ImageSource,
|
|
isSubSection = web.IsSubSection,
|
|
parentId = web.ParentId,
|
|
isBeacon = web.IsBeacon,
|
|
beaconId = web.BeaconId,
|
|
latitude = web.Latitude,
|
|
longitude = web.Longitude,
|
|
meterZoneGPS = web.MeterZoneGPS,
|
|
type = web.Type,
|
|
source = web.WebSource
|
|
},
|
|
_ => throw new NotImplementedException("Section type not handled")
|
|
};
|
|
}
|
|
}
|
|
|
|
}
|