Add resourceId to icon (Map) and slider

This commit is contained in:
Thomas Fransolet 2021-05-21 22:42:59 +02:00
parent 7c6ade79d6
commit 29ca277cf4
5 changed files with 16 additions and 135 deletions

View File

@ -10,7 +10,8 @@ namespace Manager.Interfaces.DTO
public int Zoom { get; set; } // Default = 18 public int Zoom { get; set; } // Default = 18
public MapType MapType { get; set; } // Default = Hybrid public MapType MapType { get; set; } // Default = Hybrid
public List<GeoPointDTO> Points { get; set; } public List<GeoPointDTO> Points { get; set; }
public string Icon { get; set; } // url to resource id (local) or on internet public string IconResourceId { get; set; }
public string IconSource { get; set; } // url to resource id (local) or on internet
} }
public class GeoPointDTO public class GeoPointDTO
@ -18,10 +19,18 @@ namespace Manager.Interfaces.DTO
public int Id { get; set; } public int Id { get; set; }
public List<TranslationDTO> Title { get; set; } public List<TranslationDTO> Title { get; set; }
public List<TranslationDTO> Description { get; set; } public List<TranslationDTO> Description { get; set; }
public string Image { get; set; } // url to resource id (local) or on internet public string ImageResourceId { get; set; }
public string ImageType { get; set; } // url or resource public string ImageSource { get; set; } // url to resource id (local) or on internet
public List<TranslationDTO> Text { get; set; }
public string Latitude { get; set; } public string Latitude { get; set; }
public string Longitude { get; set; } public string Longitude { get; set; }
} }
public enum MapType
{
none,
normal,
satellite,
terrain,
hybrid
}
} }

View File

@ -13,6 +13,8 @@ namespace Manager.Interfaces.DTO
public class ImageDTO { public class ImageDTO {
public List<TranslationDTO> Title { get; set; } public List<TranslationDTO> Title { get; set; }
public List<TranslationDTO> Description { get; set; } public List<TranslationDTO> Description { get; set; }
public string ResourceId { get; set; }
public string Source { get; set; } // url to resource id (local) or on internet public string Source { get; set; } // url to resource id (local) or on internet
public int Order { get; set; } // Order to show
} }
} }

View File

@ -1,78 +0,0 @@
using Manager.Interfaces.DTO;
using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Manager.Interfaces.Models
{
/// <summary>
/// Section Information - MAP
/// </summary>
public class Map : Section
{
[BsonElement("Map")]
[BsonRequired]
public MapType MapType { get; set; } = MapType.hybrid;
[BsonElement("Zoom")]
public int Zoom { get; set; } = 18;
[BsonElement("Points")]
public List<GeoPoint> Points { get; set; }
[BsonElement("Icon")]
public string Icon { get; set; } // url to resource id (local) or on internet
public MapDTO ToDetailDTO()
{
return new MapDTO()
{
/*Id = Id,
Label = Label,
Type = Type,
ImageId = ImageId,*/
MapType = MapType,
Zoom = Zoom,
Points = Points.Select(p => p.ToDTO()).ToList(),
Icon = Icon
};
}
}
public class GeoPoint
{
public int Id { get; set; }
public List<TranslationDTO> Title { get; set; }
public List<TranslationDTO> Description { get; set; }
public string Image { get; set; } // url to resource id (local) or on internet
public List<TranslationDTO> Text { get; set; }
public string Latitude { get; set; }
public string Longitude { get; set; }
public GeoPointDTO ToDTO()
{
return new GeoPointDTO()
{
Id = Id,
Title = Title,
Description = Description,
Image = Image,
Text = Text,
Latitude = Latitude,
Longitude = Longitude
};
}
}
public enum MapType
{
none,
normal,
satellite,
terrain,
hybrid
}
}

View File

@ -1,48 +0,0 @@
using Manager.Interfaces.DTO;
using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Manager.Interfaces.Models
{
/// <summary>
/// Section Information - Slider
/// </summary>
public class Slider : Section
{
[BsonElement("Images")]
public List<Image> Images { get; set; }
public SliderDTO ToDetailDTO()
{
return new SliderDTO()
{
/*Id = Id,
Label = Label,
Type = Type,
ImageId = ImageId,*/
Images = Images.Select(p => p.ToDTO()).ToList(),
};
}
}
public class Image
{
public List<TranslationDTO> Title { get; set; }
public List<TranslationDTO> Description { get; set; }
public string Source { get; set; } // url to resource id (local) or on internet
public ImageDTO ToDTO()
{
return new ImageDTO()
{
Title = Title,
Description = Description,
Source = Source
};
}
}
}

View File

@ -272,7 +272,6 @@ namespace ManagerService.Controllers
switch (newSection.Type) { switch (newSection.Type) {
case SectionType.Map: case SectionType.Map:
mapDTO = new MapDTO(); mapDTO = new MapDTO();
mapDTO.Icon = "";
mapDTO.MapType = MapType.hybrid; mapDTO.MapType = MapType.hybrid;
mapDTO.Zoom = 18; mapDTO.Zoom = 18;
@ -281,11 +280,8 @@ namespace ManagerService.Controllers
Id = 0, Id = 0,
Title = section.Title, Title = section.Title,
Description = section.Description, Description = section.Description,
Image = "", // TODO sample
ImageType = "url", // TODO
Latitude = "50.416639", Latitude = "50.416639",
Longitude= "4.879169", Longitude= "4.879169",
Text= section.Description
} }
}; };
@ -296,7 +292,7 @@ namespace ManagerService.Controllers
ImageDTO imageDTO = new ImageDTO(); ImageDTO imageDTO = new ImageDTO();
imageDTO.Title = section.Title; imageDTO.Title = section.Title;
imageDTO.Description = section.Description; imageDTO.Description = section.Description;
imageDTO.Source = ""; imageDTO.Source = null;
sliderDTO.Images = new List<ImageDTO>(); sliderDTO.Images = new List<ImageDTO>();
sliderDTO.Images.Add(imageDTO); sliderDTO.Images.Add(imageDTO);