private void SaveExecute() { try { Service.Service.AddPosition(position); addPosition.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void SaveExecute(object parameter) { try { tblPosition positionInDb = positionService.GetPositionByName(Position.PositionName); if (positionInDb != null) { string str1 = string.Format("Position with this name exists\n" + "Enter another position name"); MessageBox.Show(str1); return; } positionService.AddPosition(Position); string str = string.Format("You added new position"); MessageBox.Show(str); view.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }