Add imagesource to sectionDTO + delete sectionIds for configuration + add order to section

This commit is contained in:
Thomas Fransolet 2021-05-28 19:50:26 +02:00
parent a4a95c00e2
commit 37c667cd46
6 changed files with 15 additions and 5 deletions

View File

@ -8,7 +8,6 @@ namespace Manager.Interfaces.DTO
{
public string Id { get; set; }
public string Label { get; set; }
public List<string> SectionIds { get; set; }
public string PrimaryColor { get; set; }
public string SecondaryColor { get; set; }
public List<string> Languages { get; set; } // fr, en, de, nl => Sélection dans une liste déjà établie dans l'application !

View File

@ -12,11 +12,13 @@ namespace Manager.Interfaces.DTO
public List<TranslationDTO> Title { get; set; }
public List<TranslationDTO> Description { get; set; }
public string ImageId { get; set; } // == ResourceId
public string ImageSource { get; set; } // == Image url
public string ConfigurationId { get; set; }
public bool IsSubSection { get; set; } // true if part of menu type
public string ParentId { get; set; } // only if it's an subsection
public SectionType Type { get; set; } // !! If IsSubSection == true => Type can't not be menu !
public string Data { get; set; } // == Include section type info
public DateTime DateCreation { get; set; } // == Include section type info
public int Order { get; set; } // Order to show
}
}

View File

@ -43,7 +43,6 @@ namespace Manager.Interfaces.Models
DateCreation = DateCreation,
PrimaryColor = PrimaryColor,
Languages = Languages,
SectionIds = SectionIds, // Maybe get direct from db
SecondaryColor = SecondaryColor
};
}

View File

@ -28,6 +28,9 @@ namespace Manager.Interfaces.Models
[BsonElement("Description")]
public List<TranslationDTO> Description { get; set; }
[BsonElement("Order")]
public int Order { get; set; }
[BsonElement("ConfigurationId")]
[BsonRequired]
public string ConfigurationId { get; set; } // Parent id
@ -36,6 +39,10 @@ namespace Manager.Interfaces.Models
[BsonRequired]
public string ImageId { get; set; }
[BsonElement("ImageSource")]
[BsonRequired]
public string ImageSource { get; set; }
[BsonElement("Type")]
[BsonRequired]
public SectionType Type { get; set; }
@ -62,8 +69,10 @@ namespace Manager.Interfaces.Models
Label = Label,
Title = Title.OrderBy(t => t.Language).ToList(),
Description = Description.OrderBy(d => d.Language).ToList(),
Order = Order,
Type = Type,
ImageId = ImageId,
ImageSource = ImageSource,
ConfigurationId = ConfigurationId,
IsSubSection = IsSubSection,
ParentId = ParentId,

View File

@ -99,8 +99,7 @@ namespace ManagerService.Controllers
configuration.Label = newConfiguration.Label;
configuration.PrimaryColor = newConfiguration.PrimaryColor;
configuration.SecondaryColor = newConfiguration.SecondaryColor;
configuration.SectionIds = newConfiguration.SectionIds;
configuration.Languages = newConfiguration.Languages;
configuration.Languages = new List<string> { "FR", "NL", "EN", "DE" }; // by default all languages
configuration.DateCreation = DateTime.Now;
Configuration configurationCreated = _configurationService.Create(configuration);
@ -148,7 +147,6 @@ namespace ManagerService.Controllers
configuration.PrimaryColor = updatedConfiguration.PrimaryColor;
configuration.SecondaryColor = updatedConfiguration.SecondaryColor;
configuration.Languages = updatedConfiguration.Languages;
configuration.SectionIds = updatedConfiguration.SectionIds;
Configuration configurationModified = _configurationService.Update(updatedConfiguration.Id, configuration);

View File

@ -224,6 +224,7 @@ namespace ManagerService.Controllers
Section section = new Section();
section.Label = newSection.Label;
section.ImageId = newSection.ImageId;
section.ImageSource = newSection.ImageSource;
section.ConfigurationId = newSection.ConfigurationId;
section.DateCreation = DateTime.Now;
section.IsSubSection = newSection.IsSubSection;
@ -231,6 +232,7 @@ namespace ManagerService.Controllers
section.Type = newSection.Type;
section.Title = new List<TranslationDTO>();
section.Description = new List<TranslationDTO>();
section.Order = _sectionService.GetAllFromConfiguration(newSection.ConfigurationId).Count;
// Preparation
List<string> languages = new List<string> { "FR", "NL", "EN", "DE" };//_configurationService.GetById(newSection.ConfigurationId).Languages;
@ -436,6 +438,7 @@ namespace ManagerService.Controllers
section.Description = updatedSection.Description;
section.Type = updatedSection.Type;
section.ImageId = updatedSection.ImageId;
section.ImageSource = updatedSection.ImageSource;
section.ConfigurationId = updatedSection.ConfigurationId;
section.IsSubSection = updatedSection.IsSubSection;
section.ParentId = updatedSection.ParentId;