private void btnEdit_Click(object sender, EventArgs e) { if (StatusGrid.GetFocusedRow() is Statuses item) { frmAddEditStatus frm = new frmAddEditStatus(item, MethodType.Edit); frm.ShowDialog(); entityServerModeSource1.QueryableSource = new UnitOfWork().StatusesRepo.Fetch(); } }
private void repositoryItemButtonEdit2_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { if (MessageBox.Show("Do you want to delete this?", "Submit", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } if (StatusGrid.GetFocusedRow() is Statuses item) { UnitOfWork unitOfWork = new UnitOfWork(); unitOfWork.StatusesRepo.Delete(m => m.Id == item.Id); unitOfWork.Save(); } entityServerModeSource1.QueryableSource = new UnitOfWork().StatusesRepo.Fetch(); }