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
class Orders(View): | |
def get(self, request, *args, **kwargs): | |
... | |
id=request.GET.get("id"), |
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 void Teste() | |
{ | |
var retorno = PostAndGetArquivo(); | |
byte[] bytesImagem; | |
using (MemoryStream ms = new MemoryStream()) | |
{ | |
retorno.CopyTo(ms); | |
bytesImagem = ms.ToArray(); |
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 void Teste() | |
{ | |
var retorno = GetArquivo(); | |
byte[] bytesImagem; | |
using (MemoryStream ms = new MemoryStream()) | |
{ | |
retorno.CopyTo(ms); | |
bytesImagem = ms.ToArray(); | |
} | |
File.WriteAllBytes($"c:\\teste.png", bytesImagem); |
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
[HttpGet("contas/{idConta}/extrato")] | |
[Produces("application/json", "application/pdf")] | |
public ActionResult<ExtratoModel> GetExtrato([FromHeader] string accept, [FromQuery] string fromData) | |
{ | |
string[] acceptedTypes = accept.Split(',') | |
.Select(type => MediaTypeHeaderValue.Parse(type)) | |
.OrderByDescending(type => type.Parameters.FirstOrDefault(p => p.Name == "q")?.Value) | |
.Select(type => type.ToString()).ToArray(); | |
foreach (string acceptedType in acceptedTypes) |
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
[HttpPost("arquivos")] | |
public ActionResult Student([FromForm]ArquivoModel arquivo) | |
{ | |
string descricao = arquivo.Descricao; | |
string autor = arquivo.Autor; | |
var file = arquivo.Arquivo; | |
if (file.Length > 0) { | |
using (var fileStream = new FileStream(file.FileName, FileMode.Create)) { |