using AutobusApi.Application.Common.Mappings; using AutobusApi.Domain.Entities; using AutoMapper; namespace AutobusApi.Application.Addresses.Queries; public class AddressDto : IMapFrom
{ public int Id { get; set; } public string Name { get; set; } = null!; public double Latitude { get; set; } public double Longitude { get; set; } public string VehicleType { get; set; } = null!; public int CityId { get; set; } public string CityName { get; set; } = null!; public int RegionId { get; set; } public string RegionName { get; set; } = null!; public int CountryId { get; set; } public string CountryName { get; set; } = null!; public void Mapping(Profile profile) { profile.CreateMap() .ForMember(d => d.CityId, opt => opt.MapFrom(s => s.CityId)) .ForMember(d => d.CityName, opt => opt.MapFrom(s => s.City.Name)) .ForMember(d => d.RegionId, opt => opt.MapFrom(s => s.City.RegionId)) .ForMember(d => d.RegionName, opt => opt.MapFrom(s => s.City.Region.Name)) .ForMember(d => d.CountryId, opt => opt.MapFrom(s => s.City.Region.CountryId)) .ForMember(d => d.CountryName, opt => opt.MapFrom(s => s.City.Region.Country.Name)) .ForMember(d => d.Latitude, opt => opt.MapFrom(s => s.Location.Latitude)) .ForMember(d => d.Longitude, opt => opt.MapFrom(s => s.Location.Longitude)) .ForMember(d => d.VehicleType, opt => opt.MapFrom(s => s.VehicleType.ToString())); } }