public JsonResult GetHotelAddressById(int addressId) { _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService); Address result = _serviceEndPoint.GetHotelAddressById(addressId); return(Json(result)); }
public JsonResult GetHotelLocationByHotelId(int hotelId) { _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService); Location result = _serviceEndPoint.GetHotelLocationByHotelId(hotelId); Address address = _serviceEndPoint.GetHotelAddressById(result.AddressId); return(Json(new LocationViewModel { LocationName = result.LocationName, Address = new AddressViewModel { AddressId = address.AddressId, AddressLine1 = address.AddressLine1, AddressLine2 = address.AddressLine2, Country = address.Country, PostCode = address.PostCode, Town = address.Town, PhoneNumber = address.PhoneNumber }, AddressId = address.AddressId, LocationId = result.LocationId, Country = address.Country })); }
public JsonResult GetHotelLocations() { _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService); Location[] locations = _serviceEndPoint.GetAllHotelLocations(); var locationsViewModel = new List <LocationViewModel>(); Array.ForEach(locations, result => { Address address = _serviceEndPoint.GetHotelAddressById(result.AddressId); locationsViewModel.Add(new LocationViewModel { LocationName = result.LocationName, Address = new AddressViewModel { AddressId = address.AddressId, AddressLine1 = address.AddressLine1, AddressLine2 = address.AddressLine2, Country = address.Country, PostCode = address.PostCode, Town = address.Town, PhoneNumber = address.PhoneNumber }, AddressId = address.AddressId, LocationId = result.LocationId, Country = address.Country }); }); return(Json(locationsViewModel.ToArray())); }