This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private readonly CloudStorageAccount _storageAccount; | |
public UploadController(IConfigurationRoot configurationRoot) | |
{ | |
//Recupera a conta de armazenamento pela connection string | |
_storageAccount = CloudStorageAccount.Parse(configurationRoot["StorageConnectionString"]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IActionResult Upload(IFormFile arquivo) | |
{ | |
//Cria um blob client | |
CloudBlobClient blobClient = _storageAccount.CreateCloudBlobClient(); | |
//Recupera a referencia do container documentos | |
CloudBlobContainer container = blobClient.GetContainerReference("documentos"); | |
//Caso não exista, ele cria | |
container.CreateIfNotExists(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IActionResult VerArquivos() | |
{ | |
//Cria um blob client | |
CloudBlobClient blobClient = _storageAccount.CreateCloudBlobClient(); | |
//Recupera a referencia do container documentos | |
CloudBlobContainer container = blobClient.GetContainerReference("documentos"); | |
//Caso não exista, ele cria | |
container.CreateIfNotExists(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form class="form-horizontal" method="post" asp-action="Upload" asp-controller="Upload" enctype="multipart/form-data"> | |
<label class="col-md-4 control-label" for="arquivo">Arquivo</label> | |
<div class="col-md-4"> | |
<input type="file" id="arquivo" name="arquivo"/> | |
</div> | |
<button class="btn btn-primary"> Upload </button> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IActionResult Excluir() | |
{ | |
//Cria um blob client | |
CloudBlobClient blobClient = _storageAccount.CreateCloudBlobClient(); | |
//Recupera a referencia do container documentos | |
CloudBlobContainer container = blobClient.GetContainerReference("documentos"); | |
//Caso não exista, ele cria | |
container.CreateIfNotExists(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int[] numeros = new int[10]; | |
//Supondo que o seu TextBox tenha o nome "txtNumero" | |
//Exemplo 01 - Conversão explícita | |
int n = (int)txtNumero.Text; | |
numeros[0] = n; | |
//Exemplo 02 - int.Parse | |
int n = int.Parse(txtNumero.Text); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int numero = (int)txtNumero.Text; | |
//se o resto da divisão do número por 2 for igual a zero, o número é par. | |
if(numero % 2 == 0) | |
{ | |
//par | |
} | |
else | |
{ | |
//impar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int[] numeros = new int[10]; | |
//Preenchendo o Array | |
//Isso vc vai fazer com o TextBox e o Botão | |
for (int i = 0; i < 10; i++) | |
numeros[i] = i; | |
//Mostrando só os numeros impares | |
//Considere a variavel "richTextBox" como o seu "richTextBox.Text" | |
foreach (int item in numeros) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ViewEngines.Engines.Clear(); | |
ViewEngines.Engines.Add(new RazorViewEngine()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IEnumerable<Cliente> ClientesMasculinosComMaisDeVinteAnos(IEnumerable<Cliente> clientes) | |
{ | |
//Reparem no uso da expressão Lambda | |
return clientes.Where(c => c.Idade > 20 && c.Sexo == "Masculino"); | |
} |
OlderNewer