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
using Microsoft.AspNetCore.Builder; | |
using Microsoft.Extensions.Configuration; | |
namespace TesteMiddleware | |
{ | |
public class IndisponibilidadePipeline | |
{ | |
public void Configure(IApplicationBuilder applicationBuilder) | |
{ | |
IConfiguration config = (IConfiguration)applicationBuilder |
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
using Microsoft.AspNetCore.Mvc; | |
namespace TesteMiddleware.Controllers | |
{ | |
public class HomeController : Controller | |
{ | |
[MiddlewareFilter(typeof(IndisponibilidadePipeline))] | |
public IActionResult Index() | |
{ | |
return View(); |
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
CREATE TABLE "Cotacoes"( | |
"Sigla" char(3) NOT NULL, | |
"NomeMoeda" varchar(30) NOT NULL, | |
"UltimaCotacao" timestamp NOT NULL, | |
"Valor" numeric (18,4) NOT NULL, | |
CONSTRAINT "PK_Cotacoes" PRIMARY KEY ("Sigla") | |
); | |
INSERT INTO "Cotacoes" | |
("Sigla" |
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
using System; | |
namespace APICotacoes | |
{ | |
public class Cotacao | |
{ | |
public string Sigla { get; set; } | |
public string NomeMoeda { get; set; } | |
public DateTime UltimaCotacao { get; set; } | |
public decimal Valor { get; set; } |
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
{ | |
"ConnectionStrings": { | |
"BaseCotacoes": "Host=?;Port=5432;Pooling=true;Database=?;User Id=?;Password=?;" | |
}, | |
"Logging": { | |
"IncludeScopes": false, | |
"LogLevel": { | |
"Default": "Debug", | |
"System": "Information", | |
"Microsoft": "Information" |
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
using Microsoft.EntityFrameworkCore; | |
namespace APICotacoes | |
{ | |
public class CotacoesContext : DbContext | |
{ | |
public DbSet<Cotacao> Cotacoes { get; set; } | |
public CotacoesContext(DbContextOptions<CotacoesContext> options) : | |
base(options) |
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
using Microsoft.AspNetCore.Builder; | |
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.Extensions.Configuration; | |
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.Extensions.Logging; | |
using Microsoft.EntityFrameworkCore; | |
namespace APICotacoes | |
{ | |
public class Startup |
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
using System.Linq; | |
using Microsoft.AspNetCore.Mvc; | |
namespace APICotacoes.Controllers | |
{ | |
[Route("api/[controller]")] | |
public class CotacoesController : Controller | |
{ | |
[HttpGet("{id}")] | |
public Cotacao Get( |
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
{ | |
"BaseCotacoes": { | |
"EndpointUri": "URI_ACESSO", | |
"PrimaryKey": "CHAVE_ACESSO" | |
}, | |
"Logging": { | |
"IncludeScopes": false, | |
"LogLevel": { | |
"Default": "Debug", | |
"System": "Information", |
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
using Microsoft.AspNetCore.Builder; | |
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.Extensions.Configuration; | |
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.Extensions.Logging; | |
namespace APICotacoesNoSQL | |
{ | |
public class Startup | |
{ |