public frmAddEditDocActionTree(string category, Models.Actions item, MethodType methodType) { InitializeComponent(); this.category = category; this.item = item; this.methodType = methodType; txtParent.Properties.DataSource = new BindingList <Models.Actions>(new UnitOfWork().ActionsRepo.Get()); detail(); addNewInit(); }
void add() { try { UnitOfWork unitOfWork = new UnitOfWork(); item = new Actions(); item.Value = txtValue.Text; item.ItemOrder = txtOrder.EditValue?.ToInt(); item.ParentId = txtParent.EditValue?.ToInt(); item.Category = category; unitOfWork.ActionsRepo.Insert(item); unitOfWork.Save(); } catch (Exception e) { } }