Fix Article default value when creation
This commit is contained in:
parent
4f1902984b
commit
afdd538a3b
@ -243,6 +243,8 @@ namespace ManagerService.Controllers
|
||||
// Preparation
|
||||
List<string> languages = new List<string> { "FR", "NL", "EN", "DE" };//_configurationService.GetById(newSection.ConfigurationId).Languages;
|
||||
|
||||
var contentArticle = new List<TranslationDTO>();
|
||||
|
||||
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<QuestionDTO>();
|
||||
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<ImageDTO>();
|
||||
articleDTO.content = contentArticle;
|
||||
|
||||
section.Data = JsonConvert.SerializeObject(articleDTO); // Include all info from specific section as JSON
|
||||
break;
|
||||
}
|
||||
|
||||
Section sectionCreated = _sectionService.Create(section);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user