add title to section + fix in section update + fix in create update (slider)
This commit is contained in:
parent
65e7c7f890
commit
7a640f9d54
@ -8,7 +8,8 @@ namespace Manager.Interfaces.DTO
|
||||
public class SectionDTO
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Label { get; set; } // Dictionary<string, object> with all languages
|
||||
public string Label { get; set; } // use in manager
|
||||
public string Title { get; set; } // Dictionary<string, object> with all languages
|
||||
public string Description { get; set; } // Dictionary<string, object> with all languages
|
||||
public string ImageId { get; set; } // == RessourceId
|
||||
public string ConfigurationId { get; set; }
|
||||
|
||||
@ -18,7 +18,11 @@ namespace Manager.Interfaces.Models
|
||||
|
||||
[BsonElement("Label")]
|
||||
[BsonRequired]
|
||||
public string Label { get; set; } // Dictionary<string, object> with all languages
|
||||
public string Label { get; set; } // Use in manager
|
||||
|
||||
[BsonElement("Title")]
|
||||
[BsonRequired]
|
||||
public string Title { get; set; } // Dictionary<string, object> with all languages
|
||||
|
||||
[BsonElement("Description")]
|
||||
public string Description { get; set; } // Dictionary<string, object> with all languages
|
||||
@ -55,6 +59,7 @@ namespace Manager.Interfaces.Models
|
||||
{
|
||||
Id = Id,
|
||||
Label = Label,
|
||||
Title = Title,
|
||||
Description = Description,
|
||||
Type = Type,
|
||||
ImageId = ImageId,
|
||||
|
||||
@ -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<MapDTO>(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<ImageDTO>();
|
||||
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);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user