예제 #1
0
        public async Task UpdateAsync(AmigoEntity amigoEntity, Stream stream)
        {
            if (stream != null)
            {
                await _blobService.DeleteAsync(amigoEntity.ImageUri);

                var newUri = await _blobService.UploadAsync(stream);

                amigoEntity.ImageUri = newUri;
            }

            await _repository.UpdateAsync(amigoEntity);
        }
        public async Task UpdateAsync(LivroEntidade livroEntidade, Stream stream)
        {
            if (stream != null)
            {
                var livro = await _repository.GetByIdAsync(livroEntidade.Id);

                await _blobService.DeleteAsync(livro.ImageUri);

                var blobUri = await _blobService.UploadAsync(stream);

                livroEntidade.ImageUri = blobUri.ToString();
            }

            await _repository.UpdateAsync(livroEntidade);
        }
예제 #3
0
        public async Task <ActionResult> DeleteAsset(Guid AssetID)
        {
            var asset = _assetRepository.Get(AssetID);
            await _azureBlobService.DeleteAsync(asset.AssetFileName);

            _assetRepository.Remove(asset);
            _assetRepository.Complete();

            return(Ok("Asset deleted successfully."));
        }
예제 #4
0
        public async Task UpdateAsync(JogadorEntity jogadorEntity, string novaImagem)
        {
            if (jogadorEntity.ImageUri != null)
            {
                await _blobService.DeleteAsync(jogadorEntity.ImageUri);

                var message = new
                {
                    ImageURI = novaImagem,
                    Id       = $"{jogadorEntity.Id}",
                };

                var    jsonMessage       = JsonConvert.SerializeObject(message);
                var    bytesJsonMessage  = UTF8Encoding.UTF8.GetBytes(jsonMessage);
                string jsonMessageBase64 = Convert.ToBase64String(bytesJsonMessage);

                await _queueService.SendAsync(jsonMessageBase64);
            }
            await _repository.UpdateAsync(jogadorEntity);

            await _historicoRepository.InsertAsync(new JogadorHistoricoEntity(jogadorEntity));
        }
예제 #5
0
        public async Task <ActionResult> DeleteImage(string fileUri)
        {
            try
            {
                await _azureBlobService.DeleteAsync(fileUri);

                return(RedirectToAction("AddDoctor"));
            }
            catch (Exception ex)
            {
                ViewData["message"] = ex.Message;
                ViewData["trace"]   = ex.StackTrace;
                return(View("Error"));
            }
        }
        public async Task <IActionResult> Delete(string[] ids)
        {
            await AuthorizeHostAsync(BlobFunctionName);

            if (ids == null || ids.Length == 0)
            {
                ModelState.AddModelError(nameof(ids), "Ids should not be empty.");

                return(BadRequest(ModelState));
            }

            await _blobService.DeleteAsync(ids, GetEmbeddedUser(), GetClientIP());

            return(NoContent());
        }
        public async Task DeleteAsync(Professor professor)
        {
            await _blobService.DeleteAsync(professor.ImageUri);

            await _professorRepository.DeleteAsync(professor.Id);
        }
        public async Task DeleteAsync(Post post)
        {
            await _blobService.DeleteAsync(post.BlobUri);

            await _postRepository.DeleteAsync(post.Id);
        }