public void Save(Call call) { if (call.ID == 0) { Insert(call); } else { Update(call); } }
private void toolStripButtonAdd_Click(object sender, EventArgs e) { Call call = new Call(); FormAddEditCall formAddCall = new FormAddEditCall(call, user); if (formAddCall.ShowDialog() == DialogResult.OK) { CallsRepository callsRepository = new CallsRepository(); callsRepository.Save(call); BindControls(); } }
private void Update(Call call) { dataBase.Entry(call).State = EntityState.Modified; dataBase.SaveChanges(); }
private void Insert(Call call) { dataBase.Calls.Add(call); dataBase.SaveChanges(); }
public void Delete(Call call) { dataBase.Entry(call).State = EntityState.Deleted; dataBase.SaveChanges(); }
public FormAddEditCall(Call call, User user) { InitializeComponent(); this.call = call; this.user = user; }