public async Task <ActionResult> Edit(int id, PerfilDataModel model) { 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.Foto = blob.StorageUri.PrimaryUri.ToString(); await _clientHelper.PutPerfilAsync(id, model); return(RedirectToAction("Index")); } catch { return(View()); } }
public async Task <ActionResult> Create(PerfilBindingModel perfil) { var model = new PerfilDataModel() { Email = perfil.Email, Nome = perfil.Nome, Sobrenome = perfil.Sobrenome }; 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.Foto = blob.StorageUri.PrimaryUri.ToString(); await _clientHelper.PostPerfilAsync(model); return(RedirectToAction("Index")); } catch { return(View()); } }
public async Task <HttpResponseMessage> PutPerfilAsync(int id, PerfilDataModel model) { return(await _client.PutAsJsonAsync($"api/Perfil/{id}", model)); }
// perfilHelper #region public async Task <HttpResponseMessage> PostPerfilAsync(PerfilDataModel model) { return(await _client.PostAsJsonAsync("api/Perfil/Post", model)); }