/// <summary> /// Добавление департамента /// </summary> public void AddDepartments() { EditDep EditDepWindow = new EditDep(); IDep = EditDepWindow; EditDepWindow.ShowDialog(); if (EditDepWindow.DialogResult.Value) { Deparments newDep = new Deparments { DepName = IDep.DepName }; if (post <Deparments>(ref newDep, $"adddepartments")) { db.Add(newDep); } } }
/// <summary> /// Редактирование департамента /// </summary> public void EditDepartments() { if (IMain.curDep == null) { return; } EditDep EditDepWindow = new EditDep(); IDep = EditDepWindow; IDep.DepName = IMain.curDep.DepName; EditDepWindow.ShowDialog(); if (EditDepWindow.DialogResult.Value) { Deparments newDep = new Deparments { DepName = IDep.DepName }; if (post <Deparments>(ref newDep, $"editdepartment/{IMain.curDep.Id}")) { IMain.curDep.DepName = newDep.DepName; } } }