Fix Article default value when creation
This commit is contained in:
parent
4f1902984b
commit
afdd538a3b
@ -243,6 +243,8 @@ namespace ManagerService.Controllers
|
|||||||
// Preparation
|
// Preparation
|
||||||
List<string> languages = new List<string> { "FR", "NL", "EN", "DE" };//_configurationService.GetById(newSection.ConfigurationId).Languages;
|
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 mapDTO = new MapDTO(); // For menu dto
|
||||||
var sliderDTO = new SliderDTO(); // For menu dto
|
var sliderDTO = new SliderDTO(); // For menu dto
|
||||||
|
|
||||||
@ -250,29 +252,36 @@ namespace ManagerService.Controllers
|
|||||||
{
|
{
|
||||||
TranslationDTO title = new TranslationDTO();
|
TranslationDTO title = new TranslationDTO();
|
||||||
TranslationDTO description = new TranslationDTO();
|
TranslationDTO description = new TranslationDTO();
|
||||||
|
TranslationDTO content = new TranslationDTO();
|
||||||
title.language = language.ToUpper();
|
title.language = language.ToUpper();
|
||||||
description.language = language.ToUpper();
|
description.language = language.ToUpper();
|
||||||
|
content.language = language.ToUpper();
|
||||||
switch (language.ToUpper())
|
switch (language.ToUpper())
|
||||||
{
|
{
|
||||||
case "FR":
|
case "FR":
|
||||||
title.value = "Titre en français";
|
title.value = "Titre en français";
|
||||||
description.value = "Description en français";
|
description.value = "Description en français";
|
||||||
|
content.value = "Contenu en français";
|
||||||
break;
|
break;
|
||||||
case "EN":
|
case "EN":
|
||||||
title.value = "Title in english";
|
title.value = "Title in english";
|
||||||
description.value = "Description en anglais";
|
description.value = "Description en anglais";
|
||||||
|
content.value = "Contenu en anglais";
|
||||||
break;
|
break;
|
||||||
case "NL":
|
case "NL":
|
||||||
title.value = "Titre in dutch";
|
title.value = "Titre in dutch";
|
||||||
description.value = "Description en néerlandais";
|
description.value = "Description en néerlandais";
|
||||||
|
content.value = "Contenu en néerlandais";
|
||||||
break;
|
break;
|
||||||
case "DE":
|
case "DE":
|
||||||
title.value = "Titre en allemand";
|
title.value = "Titre en allemand";
|
||||||
description.value = "Description en allemand";
|
description.value = "Description en allemand";
|
||||||
|
content.value = "Contenu en allemand";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
section.Title.Add(title);
|
section.Title.Add(title);
|
||||||
section.Description.Add(description);
|
section.Description.Add(description);
|
||||||
|
contentArticle.Add(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
section.Title = section.Title.OrderBy(t => t.language).ToList();
|
section.Title = section.Title.OrderBy(t => t.language).ToList();
|
||||||
@ -338,6 +347,13 @@ namespace ManagerService.Controllers
|
|||||||
quizzDTO.questions = new List<QuestionDTO>();
|
quizzDTO.questions = new List<QuestionDTO>();
|
||||||
section.Data = JsonConvert.SerializeObject(quizzDTO); // Include all info from specific section as JSON
|
section.Data = JsonConvert.SerializeObject(quizzDTO); // Include all info from specific section as JSON
|
||||||
break;
|
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);
|
Section sectionCreated = _sectionService.Create(section);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user