Skip to content

Commit

Permalink
feat: functionality to manually change the currency exchange rate
Browse files Browse the repository at this point in the history
  • Loading branch information
matheus-mondaini committed May 28, 2023
1 parent eb71558 commit 2220ba2
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 1 deletion.
Binary file not shown.
Binary file not shown.
Binary file modified .vs/PedidoInternacional/v17/.suo
Binary file not shown.
27 changes: 26 additions & 1 deletion PedidoInternacional/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ static void Main(string[] args)
Moeda.Registrar(moedas);
break;
}
case 6:
{
Moeda.AlterarValor(moedas);
break;
}
case 7:
{
Pedido.CriarPedido(clientes, vendedores, moedas, produtos);
Expand Down Expand Up @@ -205,7 +210,7 @@ public static void Registrar(List<Moeda> moedas)
Console.Write("Digite o nome: ");
string? nomeMoeda = Console.ReadLine();
Console.Write("Digite o valor: ");
int valorMoeda = Convert.ToInt32(Console.ReadLine());
decimal valorMoeda = Convert.ToDecimal(Console.ReadLine());

Moeda moeda = new Moeda()
{
Expand All @@ -216,6 +221,26 @@ public static void Registrar(List<Moeda> moedas)
moedas.Add(moeda);
Console.WriteLine("Moeda cadastrada com sucesso");
}
public static void AlterarValor(List<Moeda> moedas)
{
Console.Write("Digite o código: ");
string? codMoeda = Console.ReadLine();

Moeda? moeda = moedas.Find(m => m.Codigo == codMoeda);

if (moeda != null)
{
Console.Write("Digite o valor de câmbio atual: ");
decimal novoValor = Convert.ToDecimal(Console.ReadLine());

moeda.Valor = novoValor;
Console.WriteLine("Valor alterado com sucesso");
}
else
{
Console.WriteLine("Moeda não encontrada");
}
}
}
public class Pedido
{
Expand Down
Binary file modified PedidoInternacional/bin/Debug/net7.0/PedidoInternacional.dll
Binary file not shown.
Binary file modified PedidoInternacional/bin/Debug/net7.0/PedidoInternacional.pdb
Binary file not shown.
Binary file modified PedidoInternacional/obj/Debug/net7.0/PedidoInternacional.dll
Binary file not shown.
Binary file modified PedidoInternacional/obj/Debug/net7.0/PedidoInternacional.pdb
Binary file not shown.
Binary file modified PedidoInternacional/obj/Debug/net7.0/ref/PedidoInternacional.dll
Binary file not shown.
Binary file not shown.

0 comments on commit 2220ba2

Please sign in to comment.