コード例 #1
0
        public async Task <PhotoContent> StorePhoto(byte[] buffer)
        {
            var now  = DateTime.Now.ToUniversalTime();
            var path = $"{_config["Photos:Path"]}/" + now.Ticks + ".jpg";

            var content = _aquariumDao.CreatePhotoReference();

            content.Date     = now;
            content.Filepath = path;
            content.Exists   = true;

            await _azureService.UploadFileToStorageContainer(buffer, path);

            if (Convert.ToBoolean(_config["Photos:ExpandSizes"]))
            {
                ExpandPhotoSizes(buffer, path);
            }
            if (_azureService.ExistsInStorageContainer(path))
            {
                _aquariumDao.UpdatePhotoReference(content);
            }
            return(content);
        }