예제 #1
0
        // GET: api/TourAndDetails/5
        public IHttpActionResult Get(int id)
        {
            if ((id < service.Get().Count() && id > 0) || service.Get().Where(p => p.Tours.Id == id) != null)
            {
                TourAndDetailsDTO example = service.GetId(id);
                TourAndDetails    data;

                data = new TourAndDetails()
                {
                    Tours           = mapperTour.Map <TourDTO, Tour>(example.Tours),
                    Types           = mapperType.Map <TourTypeDTO, TourType>(example.Types),
                    Infos           = mapperInfo.Map <TourInfoDTO, TourInfo>(example.Infos),
                    ListOfCountries = mapperList.Map <ListOfCountryDTO, ListOfCountry>(example.ListOfCountries),
                    Countries       = mapperCountry.Map <CountryDTO, Country>(example.Countries),
                    Regions         = mapperRegion.Map <RegionDTO, Region>(example.Regions),
                };
                return(Ok(data));
            }
            else
            {
                return(BadRequest("id was wrong<=0"));
            }
        }
예제 #2
0
 // POST: api/TourAndDetails
 public void Post([FromBody] TourAndDetails value)
 {
 }