Example #1
0
 public IActionResult ClientLogin(HotelClient client)
 {
     foreach (var u in _db.Clients)
     {
         if (u.Name == client.Name)
         {
             CurrentClient             = new HotelClient();
             CurrentClient.Name        = client.Name;
             CurrentClient.ClientID    = u.ClientID;
             CurrentClient.Email       = client.Email;
             CurrentClient.PhoneNumber = client.PhoneNumber;
             return(RedirectToAction("ClientPortal"));
         }
     }
     return(View());
 }
Example #2
0
        public IActionResult RegisterClient(HotelClient hotelClient)
        {
            if (ModelState.IsValid)
            {
                try{
                    _db.Clients.Add(hotelClient);
                    _db.SaveChanges();
                }
                catch
                {
                    return(View());
                }

                return(RedirectToAction("AdminPortal"));
            }
            return(View());
        }
        public ActionResult HotelSearch(int noOfPeople, int noOfRooms, string hotelLocation, string currentLocation)
        {
            HotelClient        hotel         = new HotelClient(noOfPeople, noOfRooms, hotelLocation, currentLocation);
            BaseHotelSearchRsp hotelResponse = hotel.HotelAvailabilty();

            HotelSearchResult[]  response = hotelResponse.HotelSearchResult;
            List <HotelProperty> result   = new List <HotelProperty>();

            foreach (HotelSearchResult rsp in response)
            {
                foreach (HotelProperty prop in rsp.HotelProperty)
                {
                    result.Add(prop);
                }
            }

            ViewBag.result = result;

            return(View());
        }
Example #4
0
        static void Main(string[] args)
        {
            string client_id     = "IwG49RrnRsJHKBZAYwFM4P5BJmoP1ynu";
            string client_secret = "Gpoqm0kWgl3lDX6b";

            //Generate access token usually valid for 1800 sec
            AuthClient authClient = new AuthClient(client_id, client_secret);
            var        token      = authClient.GenerateAccessToken();

            // Get token info to check expiry before generating another token
            token = authClient.GetTokenInfo(token.AccessToken);

            if (token.ExpiresIn > 0)
            {
                HotelClient hotelClient = new HotelClient(token.AccessToken);
                var         hotelSearch = hotelClient.GetMultiHotelOffersAsync(new AmadeusSdk.HotelSearch.MultiHotelOffersRequest()
                {
                    CityCode = "LON"
                }).Result;

                TripClient tripClient = new TripClient(token.AccessToken);
                var        pois       = tripClient.PointsOfInterest.GetPointsOfInterestAsync(41.397158, 2.160873, 2, null, null, null).Result;
            }
        }
Example #5
0
        public IActionResult RegisterClient()
        {
            HotelClient h = new HotelClient();

            return(View());
        }