public void Delete(Restaurante entity) { List <Prato> pratos = PratoRepository.GetByIdRestaurante(entity.id_restaurante); foreach (Prato p in pratos) { PratoRepository.Delete(p); } db.Restaurantes.Remove(entity); db.SaveChanges(); }
public ValidationResult Commit() { ValidationResult validation = new ValidationResult(); try { _context.SaveChanges(); } catch (Exception e) { validation.AddMessage(e.Message); } return(validation); }
public void Commit() { _context.SaveChanges(); }
public void Delete(Prato entity) { db.Pratos.Remove(entity); db.SaveChanges(); }
public int SaveChanges() { return(_context.SaveChanges()); }