private void AddOrUpdate(SessionSemester item) { var saveItem = _id == "" ? _repo.AddSessionSemester(item) : _repo.UpdateSessionSemester(item); if (saveItem == string.Empty) { Base.ShowSuccess("Success", "Session/Semester saved successfully"); this.Close(); } else { Base.ShowError("Failed", saveItem); } }
private void PerformSave(SessionSemester model) { string response; if (lblId.Text == string.Empty) //add { response = _semesterRepo.AddSessionSemester(model); if (response == string.Empty) { MessageBox.Show(this, "Session/Semester added successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearControls(); this.Hide(); } else { MessageBox.Show(this, response, "Failed", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else //update { model.Id = int.Parse(lblId.Text); response = _semesterRepo.UpdateSessionSemester(model); if (response == string.Empty) { MessageBox.Show(this, "Session/Semester updated successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearControls(); this.Hide(); } else { MessageBox.Show(this, response, "Failed", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }