diff --git a/Manager.Interfaces/DTO/SectionDTO.cs b/Manager.Interfaces/DTO/SectionDTO.cs index 4388c37..d64fd52 100644 --- a/Manager.Interfaces/DTO/SectionDTO.cs +++ b/Manager.Interfaces/DTO/SectionDTO.cs @@ -8,7 +8,8 @@ namespace Manager.Interfaces.DTO public class SectionDTO { public string Id { get; set; } - public string Label { get; set; } // Dictionary with all languages + public string Label { get; set; } // use in manager + public string Title { get; set; } // Dictionary with all languages public string Description { get; set; } // Dictionary with all languages public string ImageId { get; set; } // == RessourceId public string ConfigurationId { get; set; } diff --git a/Manager.Interfaces/Models/Section.cs b/Manager.Interfaces/Models/Section.cs index 074f286..2b86bcd 100644 --- a/Manager.Interfaces/Models/Section.cs +++ b/Manager.Interfaces/Models/Section.cs @@ -18,7 +18,11 @@ namespace Manager.Interfaces.Models [BsonElement("Label")] [BsonRequired] - public string Label { get; set; } // Dictionary with all languages + public string Label { get; set; } // Use in manager + + [BsonElement("Title")] + [BsonRequired] + public string Title { get; set; } // Dictionary with all languages [BsonElement("Description")] public string Description { get; set; } // Dictionary with all languages @@ -55,6 +59,7 @@ namespace Manager.Interfaces.Models { Id = Id, Label = Label, + Title = Title, Description = Description, Type = Type, ImageId = ImageId, diff --git a/ManagerService/Controllers/SectionController.cs b/ManagerService/Controllers/SectionController.cs index c2d3634..d19b03a 100644 --- a/ManagerService/Controllers/SectionController.cs +++ b/ManagerService/Controllers/SectionController.cs @@ -154,7 +154,7 @@ namespace ManagerService.Controllers if (section == null) throw new KeyNotFoundException("This section was not found"); - return new OkObjectResult(section); // TO TEST + return new OkObjectResult(section.ToDTO()); /*switch (section.Type) { case SectionType.Map: MapDTO mapDTO = JsonConvert.DeserializeObject(section.Data); @@ -261,6 +261,9 @@ namespace ManagerService.Controllers } } + section.Title = JsonConvert.SerializeObject(titles); + section.Description = JsonConvert.SerializeObject(descriptions); + switch (newSection.Type) { case SectionType.Map: mapDTO = new MapDTO(); @@ -289,6 +292,7 @@ namespace ManagerService.Controllers imageDTO.Title = JsonConvert.SerializeObject(titles); imageDTO.Description = JsonConvert.SerializeObject(descriptions); imageDTO.Source = ""; + sliderDTO.Images = new List(); sliderDTO.Images.Add(imageDTO); section.Data = JsonConvert.SerializeObject(sliderDTO); // Include all info from specific section as JSON @@ -427,10 +431,14 @@ namespace ManagerService.Controllers // Todo add some verification ? section.Label = updatedSection.Label; + section.Title = updatedSection.Title; + section.Description = updatedSection.Description; + section.Type = updatedSection.Type; section.ImageId = updatedSection.ImageId; + section.ConfigurationId = updatedSection.ConfigurationId; section.IsSubSection = updatedSection.IsSubSection; section.ParentId = updatedSection.ParentId; - section.Type = updatedSection.Type; + section.Data = updatedSection.Data; Section sectionModified = _sectionService.Update(updatedSection.Id, section);