public bool Deletar(int id) { var lojaDelete = _webContexto.Lojas.Where(l => l.Id == id).FirstOrDefault(); if (lojaDelete == null) { throw new Exception(); } _webContexto.Entry(lojaDelete).State = EntityState.Deleted; return(_webContexto.SaveChanges() > 0); }
public bool Deletar(int id) { var cliente = _webContexto.Clientes.Where(c => c.Id == id).FirstOrDefault(); if (cliente == null) { throw new Exception(); } _webContexto.Entry(cliente).State = EntityState.Deleted; return(_webContexto.SaveChanges() > 0); }