Esempio n. 1
0
 public List <Oferta> FiltroCategoria(string filtro)
 {
     using (fastradeContext _contexto = new fastradeContext()) {
         List <Oferta> oferta = _contexto.Oferta.Include("IdProdutoNavigation.IdCatProdutoNavigation").Where(o => o.IdProdutoNavigation.IdCatProdutoNavigation.Tipo.Contains(filtro)).ToList();
         return(oferta);
     }
 }
 public async Task <Usuario> Alterar(Usuario usuario)
 {
     using (fastradeContext _contexto = new fastradeContext()) {
         _contexto.Entry(usuario).State = EntityState.Modified;
         await _contexto.SaveChangesAsync();
     }
     return(usuario);
 }
Esempio n. 3
0
 public async Task <Endereco> Alterar(Endereco endereco)
 {
     using (fastradeContext _contexto = new fastradeContext()) {
         _contexto.Entry(endereco).State = EntityState.Modified;
         await _contexto.SaveChangesAsync();
     }
     return(endereco);
 }
Esempio n. 4
0
 public async Task <CatProduto> Alterar(CatProduto catproduto)
 {
     using (fastradeContext _contexto = new fastradeContext()) {
         _contexto.Entry(catproduto).State = EntityState.Modified;
         await _contexto.SaveChangesAsync();
     }
     return(catproduto);
 }
 public async Task <Pedido> Alterar(Pedido pedido)
 {
     using (fastradeContext _contexto = new fastradeContext()) {
         _contexto.Entry(pedido).State = EntityState.Modified;
         await _contexto.SaveChangesAsync();
     }
     return(pedido);
 }
 public async Task <Receita> Alterar(Receita receita)
 {
     using (fastradeContext _contexto = new fastradeContext()) {
         _contexto.Entry(receita).State = EntityState.Modified;
         await _contexto.SaveChangesAsync();
     }
     return(receita);
 }
Esempio n. 7
0
        public async Task <Oferta> Excluir(Oferta oferta)
        {
            using (fastradeContext _contexto = new fastradeContext()) {
                _contexto.Oferta.Remove(oferta);
                await _contexto.SaveChangesAsync();

                return(oferta);
            }
        }
Esempio n. 8
0
        public async Task <CatProduto> Excluir(CatProduto catproduto)
        {
            using (fastradeContext _contexto = new fastradeContext()) {
                _contexto.CatProduto.Remove(catproduto);
                await _contexto.SaveChangesAsync();

                return(catproduto);
            }
        }
Esempio n. 9
0
        public ActionResult <List <Oferta> > GetOrdenar()
        {
            List <Oferta> ofertas;

            using (fastradeContext _contexto = new fastradeContext()) {
                ofertas = _contexto.Oferta.OrderByDescending(c => c.Preco).ToList();
            }
            return(ofertas);
        }
Esempio n. 10
0
        public async Task <ProdutoReceita> Excluir(ProdutoReceita produtoreceita)
        {
            using (fastradeContext _contexto = new fastradeContext()) {
                _contexto.ProdutoReceita.Remove(produtoreceita);
                await _contexto.SaveChangesAsync();

                return(produtoreceita);
            }
        }
        public async Task <Pedido> Excluir(Pedido pedido)
        {
            using (fastradeContext _contexto = new fastradeContext()) {
                _contexto.Pedido.Remove(pedido);
                await _contexto.SaveChangesAsync();

                return(pedido);
            }
        }
Esempio n. 12
0
        public async Task <Endereco> Excluir(Endereco endereco)
        {
            using (fastradeContext _contexto = new fastradeContext()) {
                _contexto.Endereco.Remove(endereco);
                await _contexto.SaveChangesAsync();

                return(endereco);
            }
        }
        public async Task <Receita> Excluir(Receita receita)
        {
            using (fastradeContext _contexto = new fastradeContext()) {
                _contexto.Receita.Remove(receita);
                await _contexto.SaveChangesAsync();

                return(receita);
            }
        }
        public async Task <Usuario> Excluir(Usuario usuario)
        {
            using (fastradeContext _contexto = new fastradeContext()) {
                _contexto.Usuario.Remove(usuario);
                await _contexto.SaveChangesAsync();

                return(usuario);
            }
        }
Esempio n. 15
0
        public async Task <CatProduto> Salvar(CatProduto catproduto)
        {
            using (fastradeContext _contexto = new fastradeContext()) {
                await _contexto.AddAsync(catproduto);

                await _contexto.SaveChangesAsync();

                return(catproduto);
            }
        }
        public async Task <Usuario> Salvar(Usuario usuario)
        {
            using (fastradeContext _contexto = new fastradeContext()) {
                await _contexto.AddAsync(usuario);

                await _contexto.SaveChangesAsync();

                return(usuario);
            }
        }
Esempio n. 17
0
        public async Task <ProdutoReceita> Salvar(ProdutoReceita produtoreceita)
        {
            using (fastradeContext _contexto = new fastradeContext()) {
                await _contexto.AddAsync(produtoreceita);

                await _contexto.SaveChangesAsync();

                return(produtoreceita);
            }
        }
        public async Task <Receita> Salvar(Receita receita)
        {
            using (fastradeContext _contexto = new fastradeContext()) {
                await _contexto.AddAsync(receita);

                await _contexto.SaveChangesAsync();

                return(receita);
            }
        }
Esempio n. 19
0
        public async Task <Oferta> Salvar(Oferta oferta)
        {
            using (fastradeContext _contexto = new fastradeContext()) {
                await _contexto.AddAsync(oferta);

                await _contexto.SaveChangesAsync();

                return(oferta);
            }
        }
Esempio n. 20
0
        public async Task <Endereco> Salvar(Endereco endereco)
        {
            using (fastradeContext _contexto = new fastradeContext()) {
                await _contexto.AddAsync(endereco);

                await _contexto.SaveChangesAsync();

                return(endereco);
            }
        }
        public async Task <Pedido> Salvar(Pedido pedido)
        {
            using (fastradeContext _contexto = new fastradeContext()) {
                await _contexto.AddAsync(pedido);

                await _contexto.SaveChangesAsync();

                return(pedido);
            }
        }
 public async Task <Receita> BuscarPorID(int id)
 {
     using (fastradeContext _contexto = new fastradeContext()) {
         return(await _contexto.Receita.FindAsync(id));
     }
 }
        //Validação  CPF
        public bool ValidaCPF(string cpfUsuario)
        {
            using (fastradeContext _contexto = new fastradeContext()) {
                bool  resultado = false;
                int[] v1        = { 10, 9, 8, 7, 6, 5, 4, 3, 2 };

                string cpfCalculo = "";
                int    resto      = 0;
                int    calculo    = 0;

                string digito_v1 = "";
                string digito_v2 = "";

                cpfCalculo = cpfUsuario.Substring(0, 9);

                for (int i = 0; i <= 8; i++)
                {
                    calculo += int.Parse(cpfCalculo[i].ToString()) * v1[i];
                }

                resto   = calculo % 11;
                calculo = 11 - resto;

                if (calculo > 9)
                {
                    digito_v1 = "0";
                }
                else
                {
                    digito_v1 = calculo.ToString();
                }

                if (digito_v1 == cpfUsuario[9].ToString())
                {
                    resultado = true;
                }

                int[] v2 = { 11, 10, 9, 8, 7, 6, 5, 4, 3, 2 };
                resto = 0;


                cpfCalculo = cpfCalculo + calculo.ToString();

                calculo = 0;

                for (int i = 0; i <= 8; i++)
                {
                    calculo += int.Parse(cpfCalculo[i].ToString()) * v2[i];
                }

                resto   = calculo % 11;
                calculo = 11 - resto;

                if (calculo > 9)
                {
                    digito_v2 = "0";
                }
                else
                {
                    digito_v2 = calculo.ToString();
                }

                if (digito_v2 == cpfUsuario[10].ToString())
                {
                    resultado = true;
                }

                return(resultado);
            }
        }
 public async Task <List <Usuario> > Listar()
 {
     using (fastradeContext _contexto = new fastradeContext()) {
         return(await _contexto.Usuario.Include("IdTipoUsuarioNavigation").ToListAsync());
     }
 }
        //Validação do CNPJ
        public bool ValidaCNPJ(string cnpjUsuario)
        {
            using (fastradeContext _contexto = new fastradeContext()) {
                bool  resultado = false;
                int[] v1        = { 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2 };

                string cnpjCalculo = "";
                int    resto       = 0;
                int    calculo     = 0;

                string digito_v1 = "";
                string digito_v2 = "";


                cnpjCalculo = cnpjUsuario.Substring(0, 12);

                for (int i = 0; i <= 11; i++)
                {
                    calculo += int.Parse(cnpjCalculo[i].ToString()) * v1[i];
                }

                resto   = calculo % 11;
                calculo = 11 - resto;

                if (resto < 2)
                {
                    digito_v1 = "0";
                }
                else
                {
                    digito_v1 = calculo.ToString();
                }

                if (digito_v1 == cnpjUsuario[12].ToString())
                {
                    resultado = true;
                }

                int[] v2 = { 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2 };
                resto = 0;

                cnpjCalculo = cnpjCalculo = calculo.ToString();

                calculo = 0;

                for (int i = 0; i <= 11; i++)
                {
                    calculo += int.Parse(cnpjCalculo[i].ToString()) * v2[i];
                }

                resto   = calculo % 11;
                calculo = 11 - resto;

                if (resto < 2)
                {
                    digito_v2 = "0";
                }
                else
                {
                    digito_v2 = calculo.ToString();
                }

                if (digito_v2 == cnpjUsuario[12].ToString())
                {
                    resultado = true;
                }

                return(resultado);
            }
        }
Esempio n. 26
0
 public async Task <Endereco> BuscarPorID(int id)
 {
     using (fastradeContext _contexto = new fastradeContext()) {
         return(await _contexto.Endereco.FindAsync(id));
     }
 }
 public async Task <List <Receita> > Listar()
 {
     using (fastradeContext _contexto = new fastradeContext()) {
         return(await _contexto.Receita.ToListAsync());
     }
 }
 public async Task <Usuario> BuscarPorID(int id)
 {
     using (fastradeContext _contexto = new fastradeContext()) {
         return(await _contexto.Usuario.Include("IdTipoUsuarioNavigation").FirstOrDefaultAsync(e => e.IdUsuario == id));
     }
 }
Esempio n. 29
0
 public async Task <List <Endereco> > Listar()
 {
     using (fastradeContext _contexto = new fastradeContext()) {
         return(await _contexto.Endereco.ToListAsync());
     }
 }
Esempio n. 30
0
 public async Task <List <ProdutoReceita> > Listar()
 {
     using (fastradeContext _contexto = new fastradeContext()) {
         return(await _contexto.ProdutoReceita.Include("IdProdutoNavigation").Include("IdReceitaNavigation").ToListAsync());
     }
 }