private async void btnDelete_Click(object sender, EventArgs e) { var amenity = await _amenityService.Delete <Model.Amenity>(AmenityId); MessageBox.Show("Obrisano!"); this.Close(); var frm = new ucAmenities(); var frmIndex = Application.OpenForms["frmIndex"]; var panelContainer = frmIndex.Controls.Find("panelMain", true).FirstOrDefault() as Panel; PanelHelper.AddPanel(panelContainer, frm); }
private async void btnSave_Click(object sender, EventArgs e) { var request = new AmenityUpsertRequest { Name = txtName.Text }; var idObj = cmbCategory.SelectedValue; if (int.TryParse(idObj.ToString(), out int id)) { request.AmenitiesCategoryId = id; } var amenity = await _amenityService.Update <Model.Amenity>(AmenityId, request); MessageBox.Show("Spremljeno!"); this.Close(); var frm = new ucAmenities(); var frmIndex = Application.OpenForms["frmIndex"]; var panelContainer = frmIndex.Controls.Find("panelMain", true).FirstOrDefault() as Panel; PanelHelper.AddPanel(panelContainer, frm); }