-
-
Save mr5z/ebf981a20de99f7d9a3bc501a3650956 to your computer and use it in GitHub Desktop.
loop to linq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = response.Data | |
.Select(dto => Mapper.Map<SafeZoneDTO, SafeZone>(dto)) | |
.Select(safeZone => safeZone.Points) | |
.Select(model => new SafeZonePosition { | |
Latitude = model.Latitude, | |
Longitude = model.Longitude, | |
SafeZoneId = safeZone.Id | |
}); | |
foreach (var dto in response.Data) { | |
var model = Mapper.Map<SafeZoneDTO, SafeZone>(dto); | |
foreach (var data in model.Points) { | |
var safeZonePositionData = new SafeZonePosition(); | |
safeZonePositionData.Latitude = data.Latitude; | |
safeZonePositionData.Longitude = data.Longitude; | |
safeZonePositionData.SafeZoneId = model.Id; | |
listOfPoints.Add(safeZonePositionData); | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment