public void Atualiza(PacienteTO paciente) { Paciente entity = this.Contexto.Pacientes.Where(p => p.id == paciente.Id).FirstOrDefault(); entity.Apply(paciente); entity.DataEdicao = DateTime.Now; this.Contexto.Entry(entity).State = EntityState.Modified; this.Contexto.SaveChanges(); }
public void Atualiza(PacienteTO paciente) { Paciente entity = this.GetPaciente(paciente.Id); entity.Apply(paciente); entity.DataModificacao = DateTime.Now; this.Contexto.Entry(entity).State = EntityState.Modified; this.Contexto.SaveChanges(); }
public void Novo(PacienteTO paciente) { Paciente entity = new Paciente(); entity.DataCriacao = DateTime.Now; entity.DataEdicao = DateTime.Now; entity.Apply(paciente); this.Contexto.Pacientes.Add(entity); this.Contexto.SaveChanges(); }