public void Save() { if (CheckData()) { AutoService service = new AutoService(); if ((this.DataContext as AutoEntity).Id == -1 && !CheckDoppione()) { if (service.Add(this.DataContext as AutoEntity) == 0) { MessageBox.Show("Salvato!"); this.DataContext = new AutoEntity(); } else { MessageBox.Show("Errore durante il salvataggio!"); } } else { if (service.Update(this.DataContext as AutoEntity) == 0) { MessageBox.Show("Salvato!"); } else { MessageBox.Show("Errore durante il salvataggio!"); } } } }
public void UpdateAuto(AutoDto autoDto) { autoService.Update(autoDto); }