Example #1
0
        public async Task <IActionResult> Create([Bind("Id,Nom_PLA,Vat_PLA,EmailPro_PLA,FreeText_PLA,Logo_PLA,AddrPostalC_PLA,AddrCity_PLA,AddrCountry_PLA,AddrStreet_PLA,AddrPostBox_PLA,Phone_PLA,EmailPlace_PLA,Site_PLA,Instagram_PLA,Facebook_PLA,Linkedin_PLA,Hours_PLA,Picture_PLA")] Place place)
        {
            if (ModelState.IsValid)
            {
                _context.Add(place);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(place));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,IsComplete")] Place place)
        {
            if (ModelState.IsValid)
            {
                _context.Add(place);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(place));
        }
        public async Task <IActionResult> Create([Bind("Id,Stand,Shelf,Number,BookId")] Place place)
        {
            if (ModelState.IsValid)
            {
                _context.Add(place);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BookId"] = new SelectList(_context.Books, "Id", "Title", place.BookId);
            return(View(place));
        }
Example #4
0
        public void GetPlacesIasi(string givenType)
        {
            SearchPlaceType type = SearchPlaceType.Cafe;

            if (givenType == "airport")
            {
                type = SearchPlaceType.Airport;
            }
            else if (givenType == "atm")
            {
                type = SearchPlaceType.Atm;
            }
            else if (givenType == "bank")
            {
                type = SearchPlaceType.Bank;
            }
            else if (givenType == "beautysalon")
            {
                type = SearchPlaceType.BeautySalon;
            }
            else if (givenType == "bookstore")
            {
                type = SearchPlaceType.BookStore;
            }
            else if (givenType == "cafe")
            {
                type = SearchPlaceType.Cafe;
            }
            else if (givenType == "carwash")
            {
                type = SearchPlaceType.CarWash;
            }
            else if (givenType == "church")
            {
                type = SearchPlaceType.Church;
            }
            else if (givenType == "gasstation")
            {
                type = SearchPlaceType.GasStation;
            }
            else if (givenType == "gym")
            {
                type = SearchPlaceType.Gym;
            }
            else if (givenType == "hospital")
            {
                type = SearchPlaceType.Hospital;
            }
            else if (givenType == "library")
            {
                type = SearchPlaceType.Library;
            }
            else if (givenType == "club")
            {
                type = SearchPlaceType.NightClub;
            }
            else if (givenType == "park")
            {
                type = SearchPlaceType.Park;
            }
            else if (givenType == "restaurant")
            {
                type = SearchPlaceType.Restaurant;
            }
            else if (givenType == "school")
            {
                type = SearchPlaceType.School;
            }
            else if (givenType == "mall")
            {
                type = SearchPlaceType.ShoppingMall;
            }
            else if (givenType == "university")
            {
                type = SearchPlaceType.University;
            }
            else if (givenType == "zoo")
            {
                type = SearchPlaceType.Zoo;
            }

            var request = new PlacesNearBySearchRequest
            {
                Location = new Location(47.1584549, 27.601441),
                Radius   = 5000,
                Type     = type,
                Key      = "AIzaSyDIBvIu8PiqdBewk342wTL7B9M-ym5bK84"
            };

            var result = GooglePlaces.NearBySearch.Query(request);

            Place place = new Place();

            foreach (var it in result.Results)
            {
                Place placeToInsert = place.Create(it.PlaceId, it.Name, it.Geometry.Location.Latitude, it.Geometry.Location.Longitude,
                                                   it.Rating, it.Vicinity, it.IconUrl);

                _context.Add(placeToInsert);
            }
        }