Skip to content

Instantly share code, notes, and snippets.

View flaviorl-net's full-sized avatar
🎯
Focusing

Flavio flaviorl-net

🎯
Focusing
  • Itaú Unibanco
  • São Paulo - Brasil
View GitHub Profile
public class Sum : IStrategy<int, StrcNumeros>
{
public int Execute(StrcNumeros numeros)
{
return numeros.Numero1 + numeros.Numero2;
}
}
public interface IStrategy<out TResponse, in TRequest>
{
TResponse Execute(TRequest request);
}
using System;
using System.Linq;
using System.Collections.Generic;
namespace Strategy
{
class Program
{
static void Main(string[] args)
{
namespace Strategy
{
class Program
{
static void Main(string[] args)
{
Console.Write("Escolha a operação: (sum, sub, mult, div): ");
string operacao = Console.ReadLine();
Console.Write("Digite o primeiro número: ");
using System;
namespace Strategy
{
public class Program
{
public static void Main(string[] args)
{
Context context1 = new Context(new ConcreteStrategyA());
context1.ContextInterface();
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
using TestMediator.Event;
namespace TestMediator.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class PagamentoController : ControllerBase
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
using TestMediator.Command;
namespace TestMediator.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class EnderecoController : ControllerBase
using System.Threading;
using System.Threading.Tasks;
using TestMediator.Event;
using TestMediator.Interfaces;
namespace TestMediator.EventHandle
{
public class PagamentoEventHandle : IEventHandle<PagamentoEvent>
{
public async Task Handle(PagamentoEvent notification, CancellationToken cancellationToken)
namespace TestMediator.Event
{
public class PagamentoEvent : Interfaces.IEvent
{
public int Id { get; private set; }
public int IdPedido { get; private set; }
public int IdCliente { get; private set; }
public string Cartao { get; private set; }
public PagamentoEvent(int id, int idPedido, int idCliente, string cartao)
using System.Threading;
using System.Threading.Tasks;
using TestMediator.Command;
using TestMediator.Interfaces;
namespace TestMediator.CommandHandle
{
public class CadastrarEnderecoHandle : ICommandHandle<CadastrarEnderecoCommand, string>
{
public async Task<string> Handle(CadastrarEnderecoCommand request, CancellationToken cancellationToken)