public IActionResult Add() { Company company = new Company { CompanyName = "test", }; _logic.Add(company); return(Ok(_configuration["configName"])); }
private void button1_Click(object sender, EventArgs e) { try { var companysItems = companyBox.Lines.Select(n => new CompanyItem() { Name = n }).ToList(); DeleteCompanys(companysItems); companyLogic.Add(companysItems); MessageBox.Show($"保存成功", "Info", MessageBoxButtons.OK); companies = companyLogic.GetCompanys().Select(n => n.Name).ToList(); } catch (Exception exception) { Console.WriteLine(exception); MessageBox.Show($"发生错误:{exception.Message}", "Error", MessageBoxButtons.OK); } }
public ResponseDTO <int> Add(RequestDTO <CatalogsDTO> request) { var response = new ResponseDTO <int>(); try { response = companyLogic.Add(request.Signature); } catch (System.Data.SqlClient.SqlException exception) { response.Success = false; response.Message = exception.Message; ExceptionHandler.Instance.WriteExceptionLog(exception); } catch (System.Exception exception) { response.Success = false; response.Message = exception.Message; ExceptionHandler.Instance.WriteExceptionLog(exception); } return(response); }