Esempio n. 1
0
        public async Task <ActionResult <RespostaPadrao> > GetDivisoresPrimos(int num1)
        {
            IOperacoesMatematicas operacoesMatematicas = new OperacoesMatematicasRepository();

            RespostaPadrao resposta = new RespostaPadrao();

            try
            {
                resposta = await operacoesMatematicas.RetornaNumerosDivisores(num1);

                if (resposta.DeuErro == false)
                {
                    if (resposta.Resultados.Count > 0)
                    {
                        resposta = await operacoesMatematicas.RetornaNumerosDivisoresPrimos(num1, resposta);
                    }
                }

                return(resposta);
            }
            catch (Exception ex)
            {
                return(NotFound(
                           new
                {
                    Mensagem = ex.Message
                }));
            }
        }
Esempio n. 2
0
        public async Task <ActionResult <RespostaPadrao> > GetNumeriPrimoAsync(int num1)
        {
            IOperacoesMatematicas operacoesMatematicas = new OperacoesMatematicasRepository();

            try
            {
                return(await operacoesMatematicas.RetornaSeNumeroEhPrimo(num1));
            }
            catch (Exception ex)
            {
                return(NotFound(
                           new
                {
                    Mensagem = ex.Message
                }));
            }
        }
Esempio n. 3
0
        public async Task <ActionResult <RespostaPadrao> > GetMultiplicacaoAsync(double num1, double num2)
        {
            IOperacoesMatematicas operacoesMatematicas = new OperacoesMatematicasRepository();

            try
            {
                return(await operacoesMatematicas.Multiplicacao(num1, num2));
            }
            catch (Exception ex)
            {
                return(NotFound(
                           new
                {
                    Mensagem = ex.Message
                }));
            }
        }