public void Edit(Profissional item) { Validate(item); //Se chegou aqui, pode dale using (PutsContext db = new PutsContext()) { db.Entry <Profissional>(item).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } }
public void Delete(Profissional item) { using (PutsContext db = new PutsContext()) { Profissional profissional = db.Profissionais.Find(item.ID); if (profissional.Servicos == null || profissional.Servicos.Count == 0) { db.Entry <Profissional>(profissional).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); } } }
public void Delete(Quarto item) { using (PutsContext db = new PutsContext()) { Quarto quarto = db.Quartos.Find(item.ID); if (quarto.Servicos == null || quarto.Servicos.Count == 0) { db.Entry <Quarto>(quarto).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); } } }
public void Delete(Cliente item) { using (PutsContext db = new PutsContext()) { Cliente cliente = db.Clientes.Find(item.ID); if (cliente.Servicos == null || cliente.Servicos.Count == 0) { db.Entry <Cliente>(cliente).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); } } }