Exemple #1
0
        public async Task <IActionResult> Put(int id, PlacePhotos placePhotos)
        {
            if (id != placePhotos.PlacePhotosID)
            {
                return(BadRequest());
            }

            _context.Entry(placePhotos).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PlacePhotosExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #2
0
    IEnumerator GetPhotos(string place_id)
    {
        WWW    www;
        string photo_reference = "";

        if (currentPlace?.data.placeDetails.result.photos == null)
        {
            www = new WWW(PHPProxy.Escape(PlaceDetails.BuildURL(
                                              place_id,
                                              PlaceDetails.Fields.photo |
                                              PlaceDetails.Fields.place_id)));
            yield return(www);

            if (www.error != null)
            {
                Debug.Log(www.error);
                yield break;
            }

            PlaceDetails place = JsonUtility.FromJson <PlaceDetails>(www.text);

            if (place.status != "OK")
            {
                Debug.Log(place.error_message);
                yield break;
            }

            if (place.result?.photos == null ||
                place.result?.photos.Length == 0)
            {
                yield break;
            }

            photo_reference = place.result.photos[0].photo_reference;
        }
        else if (currentPlace.data.placeDetails.result.photos.Length == 0)
        {
            yield break;
        }
        else
        {
            photo_reference = currentPlace.data.placeDetails.result.photos[0].photo_reference;
        }

        www = new WWW(PHPProxy.Escape(PlacePhotos.BuildURL(
                                          photo_reference,
                                          (int)this.RectTransform().rect.width, 0)));
        yield return(www);

        if (www.error != null)
        {
            Debug.Log(www.error);
            yield break;
        }

        Rect rect = new Rect(0, 0, www.texture.width, www.texture.height);

        currentPhoto.rectTransform.sizeDelta = rect.size;
        currentPhoto.color  = Color.white;
        currentPhoto.name   = photo_reference;
        currentPhoto.sprite = Sprite.Create(www.texture, rect, new Vector2(.5f, .5f));
        photoHolder.SetActive(true);
    }