Example #1
0
        public void Salvar(Morador morador)
        {
            try
            {
                Morador m = ObterPorId(morador.Id);
                if (m != null)
                {
                    _condominioDbContext.Entry <Morador>(m).State = EntityState.Detached;
                    _condominioDbContext.SaveChanges();

                    _condominioDbContext.Morador.Update(morador);
                }
                else
                {
                    _condominioDbContext.Morador.Add(morador);
                }
                _condominioDbContext.SaveChanges();

                var pedidoSalvo = ObterPorId(morador.Id);
            }
            catch (Exception ex)
            {
                string erro = ex.Message;
            }
        }
Example #2
0
 public void StateModified(object Entity)
 {
     _Context.Entry(Entity).State = System.Data.Entity.EntityState.Modified;
 }