Exemplo n.º 1
0
        public IHttpActionResult ObterApostas(string modeloAposta)
        {
            if (string.IsNullOrWhiteSpace(modeloAposta))
            {
                return(NotFound());
            }

            try
            {
                ModeloAposta  tipoAposta = Instanciador.GerarIntancia(modeloAposta);
                List <Aposta> apostas    = tipoAposta.ObterApostas();

                return(Ok(apostas));
            }catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
Exemplo n.º 2
0
        public IHttpActionResult Apostar([FromBody] int[] numero, string modeloAposta)
        {
            if (string.IsNullOrWhiteSpace(modeloAposta))
            {
                return(NotFound());
            }

            try
            {
                ModeloAposta tipoAposta = Instanciador.GerarIntancia(modeloAposta);
                Aposta       aposta     = tipoAposta.Registrar(numero);

                return(Ok(aposta));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
Exemplo n.º 3
0
        public IHttpActionResult GerarNumero(string modeloAposta)
        {
            if (string.IsNullOrWhiteSpace(modeloAposta))
            {
                return(NotFound());
            }

            try
            {
                ModeloAposta tipoAposta = Instanciador.GerarIntancia(modeloAposta);
                List <int>   numero     = tipoAposta.GerarNumero();

                return(Ok(numero));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }