public async Task <IActionResult> CreateNewLawyer(NewLawyerModel lawyerModel) { if (ModelState.IsValid == false) { return(ValidationProblem()); } int lawyerId = await _lawyersService.CreateAsync(lawyerModel); return(Created("api/config/Lawyer", lawyerId)); }
private static SqlParamsModel GetParams_CreateAsync(NewLawyerModel lawyerModel) { var sqlModel = new SqlParamsModel { Sql = "pkg_lawyers.p_create_new_lawyer", Parameters = new OracleDynamicParameters() }; sqlModel.Parameters.Add("pi_lawyer_email", lawyerModel.LawyerEmail, dbType: OracleMappingType.Varchar2, ParameterDirection.Input); sqlModel.Parameters.Add("pi_lawyer_fullname", lawyerModel.LawyerFullname, dbType: OracleMappingType.Varchar2, ParameterDirection.Input); sqlModel.Parameters.Add("pi_lawyer_phone", lawyerModel.LawyerPhone, dbType: OracleMappingType.Varchar2, ParameterDirection.Input); sqlModel.Parameters.Add("pi_lawyer_address", lawyerModel.LawyerAddress, dbType: OracleMappingType.Varchar2, ParameterDirection.Input); sqlModel.Parameters.Add("po_lawyer_id", dbType: OracleMappingType.Int32, direction: ParameterDirection.Output); return(sqlModel); }
public async Task <int> CreateAsync(NewLawyerModel lawyerModel) { var sqlModel = new SqlParamsModel { Sql = "pkg_lawyers.p_create_new_lawyer", Parameters = new OracleDynamicParameters() }; sqlModel.Parameters.Add("pi_lawyer_email", lawyerModel.LawyerEmail, dbType: OracleMappingType.Varchar2, ParameterDirection.Input); sqlModel.Parameters.Add("pi_lawyer_fullname", lawyerModel.LawyerFullname, dbType: OracleMappingType.Varchar2, ParameterDirection.Input); sqlModel.Parameters.Add("pi_lawyer_phone", lawyerModel.LawyerPhone, dbType: OracleMappingType.Varchar2, ParameterDirection.Input); sqlModel.Parameters.Add("pi_lawyer_address", lawyerModel.LawyerAddress, dbType: OracleMappingType.Varchar2, ParameterDirection.Input); sqlModel.Parameters.Add("po_lawyer_id", dbType: OracleMappingType.Int32, direction: ParameterDirection.Output); await _dataAccess.ExecuteAsync(sqlModel); int lawyerId = (int)sqlModel.Parameters.Get <decimal>("po_lawyer_id"); return(lawyerId); }
public Task <HttpResponseMessage> AddNewLawyerAsync(NewLawyerModel lawyerDetails) { return(_http.PostAsJsonAsync(lawyerBaseUrl, lawyerDetails)); }