public ActionResult <AccommodationDTO> AddAccommodation(AccommodationDTO body)
        {
            AccommodationPortClient accPortClient = new AccommodationPortClient();
            addAccommodationRequest accRequest    = new addAccommodationRequest
            {
                AccommodationDTO = body
            };

            var acc = accPortClient.addAccommodationAsync(accRequest);

            acc.Wait();

            AccommodationDTO accTemp = new AccommodationDTO();

            accTemp = acc.Result.addAccommodationResponse.AccommodationDTO;

            Accommodation accommodation = accTemp.CreateAccommodation();

            // attach type in context so it doesn't get saved in database again and check the same for location
            _context.AccommodationTypes.Attach(accommodation.AccommodationType);

            if (_context.Locations.Any(loc => loc.Id == accommodation.Location.Id))
            {
                _context.Locations.Attach(accommodation.Location);
            }

            _context.Accommodations.Add(accommodation);
            _context.SaveChanges();

            return(Ok(accTemp));
        }
 public AddAccommodationRequestDTO(Accommodation Accommodation)
 {
     AddAccommodationRequest = new addAccommodationRequest()
     {
         accommodation = new accommodation()
         {
             Name              = Accommodation.Name,
             Description       = Accommodation.Description,
             Category          = Accommodation.Category,
             AccommodationType = (accommodationType)Enum.Parse(typeof(accommodationType), Accommodation.AccommodationType.ToString(), true),
             Address           = new AccommodationServiceReference.Address()
             {
                 Country          = Accommodation.Address.Country,
                 City             = Accommodation.Address.City,
                 Street           = Accommodation.Address.Street,
                 Number           = Accommodation.Address.Number,
                 Apartment_number = Accommodation.Address.ApartmentNumber,
                 Longitude        = Accommodation.Address.Longitude,
                 Latitude         = Accommodation.Address.Latitude,
                 Postal_code      = Accommodation.Address.PostalCode
             }
         }
     };
 }