/// <summary> /// Enter a new Client entry /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void newClientToolStripMenuItem_Click(object sender, EventArgs e) { var client = new Client(); var addClientForm = new AddClientFrm(client) { Text = Resources.CreateNewClientDialogText }; if (addClientForm.ShowDialog() == DialogResult.OK) { using (var db = new AwesomeContext()) { db.Clients.Add(client); db.SaveChanges(); } InitializeClientList(); } }
public AddClientFrm(Client model) { InitializeComponent(); btnCreateClient.Text = model.Id > 0 ? Resources.EditButtonText : Resources.CreateButtonText; this.clientBindingSource.Add(model); }