public IActionResult Get(Guid id)
        {
            var moeda = moedaRepositorio.Seleciona(id);

            if (moeda == null)
            {
                return(NotFound(new ApiCasoDeUsoSaida.Padrao()
                {
                    Mensagem = "Moeda não encontrada"
                }));
            }
            return(Ok(new ApiCasoDeUsoSaida.Seleciona <Moeda>()
            {
                Item = moeda,
                Mensagem = "Sucesso",
            }));
        }
示例#2
0
        public CambioCasoDeUsoSaida Calcular(CambioCasoDeUsoEntrada obj)
        {
            Moeda    moeda    = moedaRepositorio.Seleciona(obj.MoedaId);
            Segmento segmento = segmentoRepositorio.Seleciona(obj.SegmentoId);

            if (moeda == null || segmento == null)
            {
                throw new System.Exception("Parâmetros incorretos");
            }
            double taxa = cambioServico.PegarTaxa(moeda.Codigo);

            return(new CambioCasoDeUsoSaida
            {
                Valor = (obj.Quantidade * taxa) * (1 + segmento.Taxa)
            });
        }