Esempio n. 1
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);
        }
Esempio n. 2
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);
        }
Esempio n. 3
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);
        }