Example #1
0
 public List <PESSOA> Listar()
 {
     using (var ctx = new LEILAOEntities())
     {
         return(ctx.PESSOA.ToList());
     }
 }
Example #2
0
 public List <PRODUTO> Listar()
 {
     using (var ctx = new LEILAOEntities())
     {
         return(ctx.PRODUTO.ToList());
     }
 }
Example #3
0
 public List <LANCES> Listar()
 {
     using (var ctx = new LEILAOEntities())
     {
         return(ctx.LANCES.ToList());
     }
 }
Example #4
0
        public bool Salvar(PRODUTO PRODUTO)
        {
            int salvo = 0;

            try
            {
                using (var ctx = new LEILAOEntities())
                {
                    ctx.PRODUTO.Add(PRODUTO);
                    salvo = ctx.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(salvo > 0);
        }
Example #5
0
        public bool Salvar(PESSOA pessoa)
        {
            int salvo = 0;

            try
            {
                using (var ctx = new LEILAOEntities())
                {
                    ctx.PESSOA.Add(pessoa);
                    salvo = ctx.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(salvo > 0);
        }
Example #6
0
        public bool Salvar(LANCES LANCES)
        {
            int salvo = 0;

            try
            {
                using (var ctx = new LEILAOEntities())
                {
                    ctx.LANCES.Add(LANCES);
                    salvo = ctx.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(salvo > 0);
        }
Example #7
0
        public PRODUTO BuscaID(int ID)
        {
            PRODUTO pes = new PRODUTO();

            if (ID > 0)
            {
                using (var ctx = new LEILAOEntities())
                {
                    pes = ctx.PRODUTO.FirstOrDefault(x => x.ID == ID);
                }
            }

            if (pes == null)
            {
                pes = new PRODUTO();
            }

            return(pes);
        }
Example #8
0
        public PESSOA BuscaID(int ID)
        {
            PESSOA pes = new PESSOA();

            if (ID > 0)
            {
                using (var ctx = new LEILAOEntities())
                {
                    pes = ctx.PESSOA.FirstOrDefault(x => x.ID == ID);
                }
            }

            if (pes == null)
            {
                pes = new PESSOA();
            }

            return(pes);
        }
Example #9
0
        public LANCES BuscaID(int ID)
        {
            LANCES pes = new LANCES();

            if (ID > 0)
            {
                using (var ctx = new LEILAOEntities())
                {
                    pes = ctx.LANCES.FirstOrDefault(x => x.ID == ID);
                }
            }

            if (pes == null)
            {
                pes = new LANCES();
            }

            return(pes);
        }
Example #10
0
        public bool Remover(int ID)
        {
            int removido = 0;

            try
            {
                if (ID > 0)
                {
                    using (var ctx = new LEILAOEntities())
                    {
                        if (ctx.PRODUTO.Any(x => x.ID == ID))
                        {
                            ctx.PRODUTO.Remove(BuscaID(ID));
                            removido = ctx.SaveChanges();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(removido > 0);
        }
Example #11
0
        public bool Editar(PRODUTO PRODUTO)
        {
            int salvo = 0;

            try
            {
                if (PRODUTO.ID > 0)
                {
                    using (var ctx = new LEILAOEntities())
                    {
                        if (ctx.PRODUTO.Any(x => x.ID == PRODUTO.ID))
                        {
                            ctx.PRODUTO.Add(PRODUTO);
                            salvo = ctx.SaveChanges();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(salvo > 0);
        }
Example #12
0
        public bool Editar(PESSOA pessoa)
        {
            int salvo = 0;

            try
            {
                if (pessoa.ID > 0)
                {
                    using (var ctx = new LEILAOEntities())
                    {
                        if (ctx.PESSOA.Any(x => x.ID == pessoa.ID))
                        {
                            ctx.PESSOA.Add(pessoa);
                            salvo = ctx.SaveChanges();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(salvo > 0);
        }
Example #13
0
        public bool Editar(LANCES LANCES)
        {
            int salvo = 0;

            try
            {
                if (LANCES.ID > 0)
                {
                    using (var ctx = new LEILAOEntities())
                    {
                        if (ctx.LANCES.Any(x => x.ID == LANCES.ID))
                        {
                            ctx.LANCES.Add(LANCES);
                            salvo = ctx.SaveChanges();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(salvo > 0);
        }