Exemplo n.º 1
0
        public async Task <ActionResult> Create(GaleriaBindingModel galeria)
        {
            var model = new GaleriaDataModel()
            {
                PerfilId = galeria.PerfilId
            };

            try
            {
                HttpFileCollectionBase files = Request.Files;

                int fileCount = files.Count;

                await _blobHelper.SetupCloudBlob(connectionString);

                var blob = _blobHelper._blobCointainer.GetBlockBlobReference(_blobHelper.GetRandomBlobName(files[0].FileName));

                await blob.UploadFromStreamAsync(files[0].InputStream);

                model.FotoUrl = blob.StorageUri.PrimaryUri.ToString();

                await _clientHelper.PostGaleriaAsync(model);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 2
0
 public async Task <HttpResponseMessage> PutGaleriaAsync(int id, GaleriaDataModel model)
 {
     return(await _client.PutAsJsonAsync($"api/Galeria/{id}", model));
 }
Exemplo n.º 3
0
 // GaleriaHelper
 #region
 public async Task <HttpResponseMessage> PostGaleriaAsync(GaleriaDataModel model)
 {
     return(await _client.PostAsJsonAsync("api/Galeria/Post", model));
 }