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 class SectionDTO
|
||||||
{
|
{
|
||||||
public string Id { get; set; }
|
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 Description { get; set; } // Dictionary<string, object> with all languages
|
||||||
public string ImageId { get; set; } // == RessourceId
|
public string ImageId { get; set; } // == RessourceId
|
||||||
public string ConfigurationId { get; set; }
|
public string ConfigurationId { get; set; }
|
||||||
|
|||||||
@ -18,7 +18,11 @@ namespace Manager.Interfaces.Models
|
|||||||
|
|
||||||
[BsonElement("Label")]
|
[BsonElement("Label")]
|
||||||
[BsonRequired]
|
[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")]
|
[BsonElement("Description")]
|
||||||
public string Description { get; set; } // Dictionary<string, object> with all languages
|
public string Description { get; set; } // Dictionary<string, object> with all languages
|
||||||
@ -55,6 +59,7 @@ namespace Manager.Interfaces.Models
|
|||||||
{
|
{
|
||||||
Id = Id,
|
Id = Id,
|
||||||
Label = Label,
|
Label = Label,
|
||||||
|
Title = Title,
|
||||||
Description = Description,
|
Description = Description,
|
||||||
Type = Type,
|
Type = Type,
|
||||||
ImageId = ImageId,
|
ImageId = ImageId,
|
||||||
|
|||||||
@ -154,7 +154,7 @@ namespace ManagerService.Controllers
|
|||||||
if (section == null)
|
if (section == null)
|
||||||
throw new KeyNotFoundException("This section was not found");
|
throw new KeyNotFoundException("This section was not found");
|
||||||
|
|
||||||
return new OkObjectResult(section); // TO TEST
|
return new OkObjectResult(section.ToDTO());
|
||||||
/*switch (section.Type) {
|
/*switch (section.Type) {
|
||||||
case SectionType.Map:
|
case SectionType.Map:
|
||||||
MapDTO mapDTO = JsonConvert.DeserializeObject<MapDTO>(section.Data);
|
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) {
|
switch (newSection.Type) {
|
||||||
case SectionType.Map:
|
case SectionType.Map:
|
||||||
mapDTO = new MapDTO();
|
mapDTO = new MapDTO();
|
||||||
@ -289,6 +292,7 @@ namespace ManagerService.Controllers
|
|||||||
imageDTO.Title = JsonConvert.SerializeObject(titles);
|
imageDTO.Title = JsonConvert.SerializeObject(titles);
|
||||||
imageDTO.Description = JsonConvert.SerializeObject(descriptions);
|
imageDTO.Description = JsonConvert.SerializeObject(descriptions);
|
||||||
imageDTO.Source = "";
|
imageDTO.Source = "";
|
||||||
|
sliderDTO.Images = new List<ImageDTO>();
|
||||||
sliderDTO.Images.Add(imageDTO);
|
sliderDTO.Images.Add(imageDTO);
|
||||||
|
|
||||||
section.Data = JsonConvert.SerializeObject(sliderDTO); // Include all info from specific section as JSON
|
section.Data = JsonConvert.SerializeObject(sliderDTO); // Include all info from specific section as JSON
|
||||||
@ -427,10 +431,14 @@ namespace ManagerService.Controllers
|
|||||||
|
|
||||||
// Todo add some verification ?
|
// Todo add some verification ?
|
||||||
section.Label = updatedSection.Label;
|
section.Label = updatedSection.Label;
|
||||||
|
section.Title = updatedSection.Title;
|
||||||
|
section.Description = updatedSection.Description;
|
||||||
|
section.Type = updatedSection.Type;
|
||||||
section.ImageId = updatedSection.ImageId;
|
section.ImageId = updatedSection.ImageId;
|
||||||
|
section.ConfigurationId = updatedSection.ConfigurationId;
|
||||||
section.IsSubSection = updatedSection.IsSubSection;
|
section.IsSubSection = updatedSection.IsSubSection;
|
||||||
section.ParentId = updatedSection.ParentId;
|
section.ParentId = updatedSection.ParentId;
|
||||||
section.Type = updatedSection.Type;
|
section.Data = updatedSection.Data;
|
||||||
|
|
||||||
Section sectionModified = _sectionService.Update(updatedSection.Id, section);
|
Section sectionModified = _sectionService.Update(updatedSection.Id, section);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user