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; | |
using System.Collections.Generic; | |
using System.Text; | |
using System.Net.Mail; | |
using System.Net.Mime; | |
... | |
public bool EnviaMensagemComSendGrid() | |
{ |
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 interface IRepositorioGeneral | |
{ | |
List<VideosRetornados> RetornaQuatroVideosMaisRecentes(); | |
} |
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 class Repository_General: IRepositorioGeneral, IDisposable | |
{ | |
... | |
public SeuModeloDeDados db = new SeuModeloDeDados(); | |
private bool disposed = false; | |
public void Dispose() | |
{ | |
Dispose(true); |
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
... | |
kernel.Bind<IRepositorioGeneral>().To<Repository_General>(); | |
... |
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 class PrincipalController : Controller | |
{ | |
[Inject] | |
public IRepositorioGeneral RGeneral { get; set; } | |
... | |
public JsonResult CarregarVideosMaisRecentes() | |
{ | |
return Json(RGeneral.RetornaQuatroVideosMaisRecentes(), JsonRequestBehavior.AllowGet); |
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 AppFunc = Func< | |
IDictionary<string, object>, // Ambiente | |
Task>; // Tarefa retornada |
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
static void Main() | |
{ | |
var baseAddress = new Uri("http://localhost:5000"); | |
var config = new HttpSelfHostConfiguration(baseAddress); | |
config.Routes.MapHttpRoute("default", "{controller}"); | |
using (var svr = new HttpSelfHostServer(config)) | |
{ | |
svr.OpenAsync().Wait(); |
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
static void Main(string[] args) | |
{ | |
const string baseUrl = "http://localhost:5000/"; | |
using (WebApplication.Start<Startup>(new StartOptions { Url = baseUrl })) | |
{ | |
Console.WriteLine("Press Enter to quit."); | |
Console.ReadKey(); | |
} | |
} |
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 class Startup | |
{ | |
public void Configuration(IAppBuilder app) | |
{ | |
var config = new HttpConfiguration(); | |
config.Routes.MapHttpRoute("default", "{controller}"); | |
app.UseWebApi(config); | |
} | |
} |
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 class LoggerMiddleware : OwinMiddleware | |
{ | |
private readonly ILog _logger; | |
public LoggerMiddleware(OwinMiddleware next, ILog logger) : base(next) | |
{ | |
_logger = logger; | |
} | |
public override async Task Invoke(IOwinContext context) |