Exemplo n.º 1
0
        public AquariumSnapshot TakeSnapshot(int aquariumId, bool takePhoto)
        {
            Aquarium aquarium = _aquariumDao.GetAquariumById(aquariumId);
            var      deviceId = aquarium.Device.Id;

            AquariumSnapshot snapshot = _deviceClient.TakeSnapshot(deviceId); //todo tell device to take with image

            if (takePhoto)
            {
                var photoData = _deviceClient.TakePhoto(deviceId);
                var photo     = _photoManager.StorePhoto(photoData).Result;
                snapshot.PhotoId = photo.Id;
            }
            AquariumSnapshot newSnapshot = _aquariumDao.AddSnapshot(snapshot);

            return(newSnapshot);
        }