From afdd538a3bd3d8be4efae3c7045ce5c2ba246f6e Mon Sep 17 00:00:00 2001 From: Fransolet Thomas Date: Wed, 22 Jun 2022 18:55:20 +0200 Subject: [PATCH] Fix Article default value when creation --- ManagerService/Controllers/SectionController.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ManagerService/Controllers/SectionController.cs b/ManagerService/Controllers/SectionController.cs index f8cc193..fa7f276 100644 --- a/ManagerService/Controllers/SectionController.cs +++ b/ManagerService/Controllers/SectionController.cs @@ -243,6 +243,8 @@ namespace ManagerService.Controllers // Preparation List languages = new List { "FR", "NL", "EN", "DE" };//_configurationService.GetById(newSection.ConfigurationId).Languages; + var contentArticle = new List(); + var mapDTO = new MapDTO(); // For menu dto var sliderDTO = new SliderDTO(); // For menu dto @@ -250,29 +252,36 @@ namespace ManagerService.Controllers { TranslationDTO title = new TranslationDTO(); TranslationDTO description = new TranslationDTO(); + TranslationDTO content = new TranslationDTO(); title.language = language.ToUpper(); description.language = language.ToUpper(); + content.language = language.ToUpper(); switch (language.ToUpper()) { case "FR": title.value = "Titre en français"; description.value = "Description en français"; + content.value = "Contenu en français"; break; case "EN": title.value = "Title in english"; description.value = "Description en anglais"; + content.value = "Contenu en anglais"; break; case "NL": title.value = "Titre in dutch"; description.value = "Description en néerlandais"; + content.value = "Contenu en néerlandais"; break; case "DE": title.value = "Titre en allemand"; description.value = "Description en allemand"; + content.value = "Contenu en allemand"; break; } section.Title.Add(title); section.Description.Add(description); + contentArticle.Add(content); } section.Title = section.Title.OrderBy(t => t.language).ToList(); @@ -338,6 +347,13 @@ namespace ManagerService.Controllers quizzDTO.questions = new List(); section.Data = JsonConvert.SerializeObject(quizzDTO); // Include all info from specific section as JSON break; + case SectionType.Article: + ArticleDTO articleDTO = new ArticleDTO(); + articleDTO.images = new List(); + articleDTO.content = contentArticle; + + section.Data = JsonConvert.SerializeObject(articleDTO); // Include all info from specific section as JSON + break; } Section sectionCreated = _sectionService.Create(section);