private void SaveAdd_Click(object sender, RoutedEventArgs e) { string name = textBoxName.Text; string description = textBoxDescription.Text; string selectedFormulaName = comboBoxFormula.SelectedItem.ToString(); if (string.IsNullOrWhiteSpace(name)) { errormessage.Text = "Name can`t be null or empty"; textBoxName.Focus(); } else if (string.IsNullOrWhiteSpace(selectedFormulaName)) { errormessage.Text = "You must select formula, that will be a base for your project!"; comboBoxFormula.Focus(); } else { Project newProject = new Project() { Id = Guid.NewGuid(), Name = name, Description = description, Formula = _rFormulaService.GetFormulaIdByName(selectedFormulaName), DevelopedByCompany = _rUsersService.GetCurrentUser().CompanyId }; if (_rProjectService.AddPorject(newProject, out string error)) { Reset(); errormessage.Text = "Succesfully added!"; } else { errormessage.Text = error; } } }