private async void btnAdd_Click(object sender, EventArgs e) { if (btnAdd.Text == "Add") { if (IsValid()) { OtherSourcesList obj = new OtherSourcesList(); obj.ListOtherSources = txtOtherSources.Text; await otherSourcesList.Create(obj); frmSurveyQuestionnaire questionnaire = (frmSurveyQuestionnaire)Application.OpenForms["frmSurveyQuestionnaire"]; await questionnaire.LoadOtherSources(); this.Close(); } } if (btnAdd.Text == "Update") { if (IsValidUpdate()) { OtherSourcesList obj = await otherSourcesList.Get(frmSettings.OtherSourcesID); obj.ListOtherSources = txtOtherSources.Text; await otherSourcesList.Update(obj); frmSettings setting = (frmSettings)Application.OpenForms["frmSettings"]; await setting.LoadOtherSources(); this.Close(); } } }
private async void frmAddOtherSources_Load(object sender, EventArgs e) { await CallLoad(); if (frmSettings.OnEdit == true) { this.Text = "Update Info"; btnAdd.Text = "Update"; OtherSourcesList obj = await otherSourcesList.Get(frmSettings.OtherSourcesID); txtOtherSources.Text = obj.ListOtherSources; } }