Example #1
0
        public async Task <ActionResult <IEnumerable <CountryDto> > > Get()
        {
            var serviceResult = await _destinationService.FilterAll();

            if (serviceResult.ResponseCode != ResponseCode.Success)
            {
                return(BadRequest(serviceResult.Error));
            }



            return(Ok(serviceResult.Result.Select(x => new CountryDto
            {
                Name = x.Name,

                Cities = x.Cities.Select(y => new CityDto
                {
                    Name = y.Name,
                    Places = y.Places.Select(z => new PlaceDto
                    {
                        Address = z.Address,
                        AvailableFrom = z.AvailableFrom,
                        AvailableTo = z.AvailableTo,
                        PriceNight = z.PriceNight,
                        TypeBuilding = z.TypeBuilding,
                        WifiQuality = z.WifiQuality,
                    }).ToList(),
                    NearActivities = y.NearActivities.Select(w => new ActivityDto
                    {
                        Name = w.Name,
                    }).ToList(),
                }).ToList()
            }


                                                  )));
        }